Giter Club home page Giter Club logo

Comments (4)

StackOverflowExcept1on avatar StackOverflowExcept1on commented on August 18, 2024 3

demo to reproduce: https://github.com/StackOverflowExcept1on/alloy-bug/blob/master/src/main.rs

from alloy.

StackOverflowExcept1on avatar StackOverflowExcept1on commented on August 18, 2024 2

We should probably call SignerFiller before GasFiller to solve this problem. Here's how it works now:

impl<F, P, T, N> Provider<T, N> for FillProvider<F, P, T, N>
where
F: TxFiller<N>,
P: Provider<T, N>,
T: Transport + Clone,
N: Network,
{
fn root(&self) -> &RootProvider<T, N> {
self.inner.root()
}
async fn send_transaction_internal(
&self,
mut tx: SendableTx<N>,
) -> TransportResult<PendingTransactionBuilder<'_, T, N>> {
let mut count = 0;
while self.filler.continue_filling(&tx) {
tx = self.filler.prepare_and_fill(&self.inner, tx).await?;

from alloy.

StackOverflowExcept1on avatar StackOverflowExcept1on commented on August 18, 2024

I haven't researched this deeply, but my best guess is why this is happening: GasFiller doesn't set from field when estimating gas costs. This can lead not only to this problem, but also to an incorrect gas limit. Imagine a smart contract that, for example, does some computational work if msg.sender == owner.

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;

contract Counter {
    uint256 public number;

    function increment(address expectedAddress) public {
        if (msg.sender == expectedAddress) {
            while (true) {}
        } else {
            number++;
        }
    }
}

from alloy.

StackOverflowExcept1on avatar StackOverflowExcept1on commented on August 18, 2024

I also made another demo that doesn't work correctly in alloy: https://github.com/StackOverflowExcept1on/alloy-bug/blob/gas/src/main.rs. Alloy does not correctly calculate the gas limit and the transaction fails: https://holesky.etherscan.io/tx/0xf8dcd7ce7f92ec4dca95b0e5c1343668d5d7eee65a3f156e9806c881e1b1626a

from alloy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.