Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Transport(Custom(MissingKey("gas_price"))) in TransactionRequest #464

Closed
anna-carroll opened this issue Apr 4, 2024 · 3 comments · Fixed by #431
Closed

[Bug] Transport(Custom(MissingKey("gas_price"))) in TransactionRequest #464

anna-carroll opened this issue Apr 4, 2024 · 3 comments · Fixed by #431
Assignees
Labels
bug Something isn't working

Comments

@anna-carroll
Copy link

Component

transports

What version of Alloy are you on?

0b889d9

Operating System

macOS (Apple Silicon)

Describe the bug

I setup a RpcClient, EthereumSigner, and Provider as follows:

        let url: Url = Url::parse(HOLESKY.rpc_url)?;
        let wallet = load_aws_signer("KEY_ID", Some(HOLESKY.chain_id)).await?;

        let provider = ProviderBuilder::new()
            .layer(alloy_provider::layers::NonceManagerLayer)
            .signer(EthereumSigner::from(wallet))
            .provider(RootProvider::new(RpcClient::new_http(url.clone())));

then, I construct a TransactionRequest with a blob Sidecar attached, and attempt to send the transaction:

        let data =
            MyContract::submitCall::new(()).abi_encode();

        let tx: TransactionRequest = TransactionRequest {
            to: Some(HOLESKY.my_contract),
            from: Some(address!(HOLESKY.signer)),
            input: TransactionInput::new(data.into()),
            transaction_type: Some(Uint::from(0x03)),
            max_fee_per_blob_gas: Some(Uint::from(10)),
            max_fee_per_gas: Some(Uint::from(10)),
            max_priority_fee_per_gas: Some(Uint::from(2)),
            gas: Some(Uint::from(24000)),
            sidecar: Some(sidecar),
            ..Default::default()
        };

        let result = provider.send_transaction(tx).await?;

Running this program yields the following error:

Error: Transport(Custom(MissingKey("gas_price")))
@anna-carroll anna-carroll added the bug Something isn't working label Apr 4, 2024
@prestwich
Copy link
Member

This should be closed by #426 . I'll add a test for it

@prestwich prestwich self-assigned this Apr 5, 2024
@prestwich prestwich linked a pull request Apr 5, 2024 that will close this issue
10 tasks
@prestwich
Copy link
Member

prestwich commented Apr 5, 2024

    #[test]
    fn builds_non_legacy() {
        let sidecar = Default::default();

        let tx: TransactionRequest = TransactionRequest {
            to: Some(Address::ZERO),
            from: Some(Address::ZERO),
            input: bytes!("").into(),
            transaction_type: Some(0x03),
            max_fee_per_blob_gas: Some(10),
            max_fee_per_gas: Some(10),
            max_priority_fee_per_gas: Some(2),
            gas: Some(24000),
            sidecar: Some(sidecar),
            nonce: Some(0),
            ..Default::default()
        };

        dbg!(tx.build_unsigned().unwrap());
    }

minimalish test. fails in main

@prestwich
Copy link
Member

fails in #426. guess this will be fixed in #431

@prestwich prestwich removed a link to a pull request Apr 5, 2024
10 tasks
@prestwich prestwich linked a pull request Apr 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants