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(anvil): eth_sendRawTransaction returns invalid transaction v, r, s values #7898

Closed
2 tasks done
Tracked by #8269
colinlyguo opened this issue May 9, 2024 · 5 comments · Fixed by #7918
Closed
2 tasks done
Tracked by #8269

bug(anvil): eth_sendRawTransaction returns invalid transaction v, r, s values #7898

colinlyguo opened this issue May 9, 2024 · 5 comments · Fixed by #7918
Labels
C-anvil Command: anvil T-bug Type: bug

Comments

@colinlyguo
Copy link

colinlyguo commented May 9, 2024

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

I run Anvil inside a container, Dockerfile:

FROM ghcr.io/foundry-rs/foundry:latest

WORKDIR /app

COPY genesis.json /app/genesis.json

ENV ANVIL_IP_ADDR=0.0.0.0

ENTRYPOINT ["anvil", "--init", "/app/genesis.json"]
2024-05-08 23:46:25 
2024-05-08 23:46:25 
2024-05-08 23:46:25                              _   _
2024-05-08 23:46:25                             (_) | |
2024-05-08 23:46:25       __ _   _ __   __   __  _  | |
2024-05-08 23:46:25      / _` | | '_ \  \ \ / / | | | |
2024-05-08 23:46:25     | (_| | | | | |  \ V /  | | | |
2024-05-08 23:46:25      \__,_| |_| |_|   \_/   |_| |_|
2024-05-08 23:46:25 
2024-05-08 23:46:25     0.2.0 (2e3c197 2024-05-06T15:52:13.342058252Z)
2024-05-08 23:46:25     https://github.com/foundry-rs/foundry

What command(s) is the bug in?

Sending contract creation transactions, the contract contains blobhash op and point evaluation precompile call.

Operating System

Anvil in a Ubuntu container.

Describe the bug

Error log:

TransactionByHash isPending false err invalid transaction v, r, s values

The error log is printed by

	assert.Eventually(t, func() bool {
		_, isPending, err := l1Client.TransactionByHash(context.Background(), signedTx.Hash())
		fmt.Println("TransactionByHash", "isPending", isPending, "err", err)
		return err == nil && !isPending
	}, 30*time.Second, time.Second)

Whole code snippet:

	tx := gethTypes.NewContractCreation(nonce, big.NewInt(0), 10000000, big.NewInt(10000000000), common.FromHex(mock_bridge.MockBridgeMetaData.Bin))
	signedTx, err := auth.Signer(auth.From, tx)
	assert.NoError(t, err)
	err = l1Client.SendTransaction(context.Background(), signedTx)
	assert.NoError(t, err)

	txData, err := json.MarshalIndent(signedTx, "", "  ")
	if err != nil {
		log.Crit("failed to JSON marshal transaction", "err", err)
		return
	}
	fmt.Println("contract deployment transaction:\n", string(txData))

	txByte, err := signedTx.MarshalBinary()
	if err != nil {
		log.Crit("failed to marshal transaction to RLP encoding", "err", err)
		return
	}
	txHex := hex.EncodeToString(txByte)
	fmt.Println("rlp-encoding of contract deployment transaction:", txHex)

	assert.Eventually(t, func() bool {
		_, isPending, err := l1Client.TransactionByHash(context.Background(), signedTx.Hash())
		fmt.Println("TransactionByHash", "isPending", isPending, "err", err)
		return err == nil && !isPending
	}, 30*time.Second, time.Second)

	assert.Eventually(t, func() bool {
		receipt, err := l1Client.TransactionReceipt(context.Background(), signedTx.Hash())
		return err == nil && receipt.Status == gethTypes.ReceiptStatusSuccessful
	}, 30*time.Second, time.Second)

	assert.Eventually(t, func() bool {
		code, err := l1Client.CodeAt(context.Background(), testContractsAddress, nil)
		return err == nil && len(code) > 0
	}, 30*time.Second, time.Second)

Transaction details:

contract deployment transaction:
 {
  "type": "0x0",
  "chainId": "0x7e7e",
  "nonce": "0x0",
  "to": null,
  "gas": "0x989680",
  "gasPrice": "0x2540be400",
  "maxPriorityFeePerGas": null,
  "maxFeePerGas": null,
  "value": "0x0",
  "input": "0x6080604052348015600e575f80fd5b506116248061001c5f395ff3fe608060405234801561000f575f80fd5b50600436106100a5575f3560e01c806331fa742d1161006e57806331fa742d1461012a5780633fdeecb21461013d57806341493c6014610150578063d99bc80e14610163578063e3176bd514610175578063ea5f084f1461017d575f80fd5b8062b0f4d7146100a9578063059def61146100be5780631325aca0146100d95780632362f03e146100ec5780632571098d1461010b575b5f80fd5b6100bc6100b7366004611103565b61019c565b005b6100c760015481565b60405190815260200160405180910390f35b6100bc6100e7366004611264565b6103eb565b6100c76100fa366004611388565b60026020525f908152604090205481565b6100c7610119366004611388565b60036020525f908152604090205481565b6100bc61013836600461139f565b610564565b6100bc61014b366004611425565b6106a8565b6100bc61015e36600461146d565b61087e565b6100bc610171366004611388565b5f55565b6100c75f5481565b6100c761018b366004611388565b60046020525f908152604090205481565b866101ba57604051636af2a73b60e11b815260040160405180910390fd5b856101d85760405163f9a9465f60e01b815260040160405180910390fd5b5f805f6101e58c8c610a52565b509250925092505f6101f8846039015190565b90505f80600a6001600160a01b0316838b8b60405160200161021c939291906114d5565b60408051601f198184030181529082905261023691611505565b5f60405180830381855afa9150503d805f811461026e576040519150601f19603f3d011682016040523d82523d5f602084013e610273565b606091505b509150915081610296576040516371ebedf560e01b815260040160405180910390fd5b5f818060200190518101906102ab9190611517565b9150507f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff0000000181146102ee57604051638a89514360e01b815260040160405180910390fd5b5050508a60035f600185610302919061154d565b81526020019081526020015f20541461032e576040516347c5a1e560e01b815260040160405180910390fd5b5f828152600360205260409020541561035a5760405163092d315560e41b815260040160405180910390fd5b816001546001011461037f57604051631d17cec760e21b815260040160405180910390fd5b60018290555f8281526003602090815260408083208d905560048252918290208b905581518c81529081018b9052849184917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a350505050505050505050505050565b82515f0361040c57604051632974c17360e21b815260040160405180910390fd5b5f805f6104198888610a52565b60019091015f81815260026020526040902054929650945092501590506104535760405163012137ab60e41b815260040160405180910390fd5b5f805f808c60ff165f036104b95761046b858b610b1d565b60405196810196945090925090506104868360ff8f16610b91565b60c086811b600185015281811b600985015285901b6011840152601983018290526039830187905260598320935061051b565b5f6104c4868c610b98565b809450819550829350505050604051935081860195506104e7848f60ff16610b91565b60c087811b600186015282811b600986015286901b6011850152601984018390526039840152605983018790526079832093505b5f8681526002602052604080822086905551859188917f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f9190a350505050505050505050505050565b8461058257604051636af2a73b60e11b815260040160405180910390fd5b836105a05760405163f9a9465f60e01b815260040160405180910390fd5b5f806105ac8989610a52565b5092509250508660035f6001846105c3919061154d565b81526020019081526020015f2054146105ef576040516347c5a1e560e01b815260040160405180910390fd5b5f818152600360205260409020541561061b5760405163092d315560e41b815260040160405180910390fd5b806001546001011461064057604051631d17cec760e21b815260040160405180910390fd5b60018190555f81815260036020908152604080832089905560048252918290208790558151888152908101879052839183917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a3505050505050505050565b806106c65760405163f9a9465f60e01b815260040160405180910390fd5b5f805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff541561070e5760405163c22a199f60e01b815260040160405180910390fd5b5f8061071a8585610a52565b5050915091505f61072f836011015160c01c90565b600984015160c01c600185015160c01c855160f81c010101905080156107685760405163f4f38de560e01b815260040160405180910390fd5b505f610775836019015190565b03610793576040516303d840a960e41b815260040160405180910390fd5b5f61079f836039015190565b146107bd57604051632781461960e11b815260040160405180910390fd5b5f8080527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b82905560036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8490556040518291907f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f908290a3604080518481525f60208201819052839290917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a35050505050565b81516030146108d45760405162461bcd60e51b815260206004820152601b60248201527f436f6d6d69746d656e74206d757374206265203438206279746573000000000060448201526064015b60405180910390fd5b805160301461091e5760405162461bcd60e51b815260206004820152601660248201527550726f6f66206d75737420626520343820627974657360501b60448201526064016108cb565b604080515f8049602083018190529290917f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff000000019101604051602081830303815290604052805190602001205f1c6109749190611560565b90505f828287878760405160200161099095949392919061157f565b60405160208183030381529060405290505f600a6001600160a01b0316826040516109bb9190611505565b5f60405180830381855afa9150503d805f81146109f3576040519150601f19603f3d011682016040523d82523d5f602084013e6109f8565b606091505b5050905080610a495760405162461bcd60e51b815260206004820152601960248201527f50726f6f6620766572696669636174696f6e206661696c65640000000000000060448201526064016108cb565b50505050505050565b5f808080853560f81c81818103610a8657610a6d8888610c4f565b80822060018301519298509650915060c01c9350610aa5565b610a908888610cc8565b80822060018301519298509650915060c01c93505b5f848152600260205260409020548514801590610aea57505f805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff5415155b15610b085760405163150e0a2160e11b815260040160405180910390fd5b601186015160c01c9250505092959194509250565b8051604080516020830281019091525f918291825b82811015610b7c575f80610b60888481518110610b5157610b516115b0565b6020026020010151878b610d39565b9085529889019895909501945050602090910190600101610b32565b50602091909102908190032094909350915050565b8082535050565b5f8049908060014983610bbe57604051630168f63160e21b815260040160405180910390fd5b8015610bdd57604051630148201960e11b815260040160405180910390fd5b508351604080516020830281019091525f5b82811015610c39575f80610c1d898481518110610c0e57610c0e6115b0565b6020026020010151878c610ec7565b908552998a019995909501945050602090910190600101610bef565b5060208202808183032094505050509250925092565b5f816059811015610c735760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f610c91836009015160c01c90565b905061010060ff8201046020026059018214610cc057604051630808452960e31b815260040160405180910390fd5b509250929050565b5f816079811015610cec5760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f610d0a836009015160c01c90565b905061010060ff8201046020026079018214610cc057604051630808452960e31b815260040160405180910390fd5b60405183515f91829160208701919081908490610d57908590610fc9565b90505f805b82811015610dca57603c81028601600181015185526021015165ffffffffffff19166020850152603a840193505f610d95603c836115c4565b610da08860016115db565b610daa91906115db565b90505f610dbb826038015160f01c90565b93909301925050600101610d5c565b5060200282016040525f6001603c83028601019050610dea6001866115db565b94505b8115610e84575f610e0286603a015160f01c90565b90505f610e13876038015160f01c90565b905081811015610e3657604051638c5a4ea360e01b815260040160405180910390fd5b815b81811015610e6357835160e01c60048086018290208852602090970196940190930192600101610e38565b505098890198978801979590950194603c94909401935f1990910190610ded565b895160208b019550610e96868361154d565b14610eb45760405163670241af60e01b815260040160405180910390fd5b5050819003902096919550909350505050565b60405183515f91829160208701919081908490610ee5908590611033565b90505f5b81811015610f5257603c81028501600181015184526021015165ffffffffffff19166020840152603a830192505f610f22603c836115c4565b610f2d8760016115db565b610f3791906115db565b90505f610f4382611094565b97909701965050600101610ee9565b506020850282016040526001840193505f5b8115610eb4575f610f7486611094565b9050835f610f81886110a3565b905082811015610fa457604051638c5a4ea360e01b815260040160405180910390fd5b9a82019a99820199603c97909701965f19949094019390850392909201910301610f64565b5f610fd5835160f81c90565b9050805f03610ff757604051631f18bc2360e21b815260040160405180910390fd5b611002603c826115c4565b61100d9060016115db565b82101561102d576040516302e3d2ef60e61b815260040160405180910390fd5b92915050565b5f61103d836110b2565b9050805f0361105f57604051631f18bc2360e21b815260040160405180910390fd5b61106a603c826115c4565b6110759060016115db565b821461102d576040516302e3d2ef60e61b815260040160405180910390fd5b5f61102d82603a015160f01c90565b5f61102d826038015160f01c90565b5f61102d825160f81c90565b5f8083601f8401126110ce575f80fd5b50813567ffffffffffffffff8111156110e5575f80fd5b6020830191508360208285010111156110fc575f80fd5b9250929050565b5f805f805f805f805f60c08a8c03121561111b575f80fd5b893567ffffffffffffffff80821115611132575f80fd5b61113e8d838e016110be565b909b50995060208c0135985060408c0135975060608c0135965060808c013591508082111561116b575f80fd5b6111778d838e016110be565b909650945060a08c013591508082111561118f575f80fd5b5061119c8c828d016110be565b915080935050809150509295985092959850929598565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156111f0576111f06111b3565b604052919050565b5f82601f830112611207575f80fd5b813567ffffffffffffffff811115611221576112216111b3565b611234601f8201601f19166020016111c7565b818152846020838601011115611248575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f805f8060808789031215611279575f80fd5b863560ff81168114611289575f80fd5b955060208781013567ffffffffffffffff808211156112a6575f80fd5b6112b28b838c016110be565b909850965060408a01359150808211156112ca575f80fd5b818a0191508a601f8301126112dd575f80fd5b8135818111156112ef576112ef6111b3565b8060051b6112fe8582016111c7565b918252838101850191858101908e841115611317575f80fd5b86860192505b83831015611350578483351115611332575f80fd5b6113418f8885358901016111f8565b8252918601919086019061131d565b985050505060608a0135925080831115611368575f80fd5b505061137689828a016110be565b979a9699509497509295939492505050565b5f60208284031215611398575f80fd5b5035919050565b5f805f805f805f60a0888a0312156113b5575f80fd5b873567ffffffffffffffff808211156113cc575f80fd5b6113d88b838c016110be565b909950975060208a0135965060408a0135955060608a0135945060808a0135915080821115611405575f80fd5b506114128a828b016110be565b989b979a50959850939692959293505050565b5f805f60408486031215611437575f80fd5b833567ffffffffffffffff81111561144d575f80fd5b611459868287016110be565b909790965060209590950135949350505050565b5f805f6060848603121561147f575f80fd5b83359250602084013567ffffffffffffffff8082111561149d575f80fd5b6114a9878388016111f8565b935060408601359150808211156114be575f80fd5b506114cb868287016111f8565b9150509250925092565b838152818360208301375f910160200190815292915050565b5f81518060208401855e5f93019283525090919050565b5f61151082846114ee565b9392505050565b5f8060408385031215611528575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561102d5761102d611539565b5f8261157a57634e487b7160e01b5f52601260045260245ffd5b500690565b8581528460208201528360408201525f6115a561159f60608401866114ee565b846114ee565b979650505050505050565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761102d5761102d611539565b8082018082111561102d5761102d61153956fea264697066735822122055e51824b54daf38f041f9435915b6f86b2be4ab4bd008b9b770fd79a4b96d4264736f6c63430008190033",
  "v": "0xfd20",
  "r": "0x56e33513eb7ecf8d739c368fd98588edd095c0f9e89ea767b03ebea68a39c755",
  "s": "0x42c69d1438eadcc442c8638056c2937f209f12944240dfb43d0d80a7526f9413",
  "hash": "0x8c0a44e705982f92c757f6fa91ed3210aece63779c12b8af4697a09f0ce8a74b"
}

rlp-encoding of contract deployment transaction:

f91695808502540be400839896808080b916406080604052348015600e575f80fd5b506116248061001c5f395ff3fe608060405234801561000f575f80fd5b50600436106100a5575f3560e01c806331fa742d1161006e57806331fa742d1461012a5780633fdeecb21461013d57806341493c6014610150578063d99bc80e14610163578063e3176bd514610175578063ea5f084f1461017d575f80fd5b8062b0f4d7146100a9578063059def61146100be5780631325aca0146100d95780632362f03e146100ec5780632571098d1461010b575b5f80fd5b6100bc6100b7366004611103565b61019c565b005b6100c760015481565b60405190815260200160405180910390f35b6100bc6100e7366004611264565b6103eb565b6100c76100fa366004611388565b60026020525f908152604090205481565b6100c7610119366004611388565b60036020525f908152604090205481565b6100bc61013836600461139f565b610564565b6100bc61014b366004611425565b6106a8565b6100bc61015e36600461146d565b61087e565b6100bc610171366004611388565b5f55565b6100c75f5481565b6100c761018b366004611388565b60046020525f908152604090205481565b866101ba57604051636af2a73b60e11b815260040160405180910390fd5b856101d85760405163f9a9465f60e01b815260040160405180910390fd5b5f805f6101e58c8c610a52565b509250925092505f6101f8846039015190565b90505f80600a6001600160a01b0316838b8b60405160200161021c939291906114d5565b60408051601f198184030181529082905261023691611505565b5f60405180830381855afa9150503d805f811461026e576040519150601f19603f3d011682016040523d82523d5f602084013e610273565b606091505b509150915081610296576040516371ebedf560e01b815260040160405180910390fd5b5f818060200190518101906102ab9190611517565b9150507f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff0000000181146102ee57604051638a89514360e01b815260040160405180910390fd5b5050508a60035f600185610302919061154d565b81526020019081526020015f20541461032e576040516347c5a1e560e01b815260040160405180910390fd5b5f828152600360205260409020541561035a5760405163092d315560e41b815260040160405180910390fd5b816001546001011461037f57604051631d17cec760e21b815260040160405180910390fd5b60018290555f8281526003602090815260408083208d905560048252918290208b905581518c81529081018b9052849184917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a350505050505050505050505050565b82515f0361040c57604051632974c17360e21b815260040160405180910390fd5b5f805f6104198888610a52565b60019091015f81815260026020526040902054929650945092501590506104535760405163012137ab60e41b815260040160405180910390fd5b5f805f808c60ff165f036104b95761046b858b610b1d565b60405196810196945090925090506104868360ff8f16610b91565b60c086811b600185015281811b600985015285901b6011840152601983018290526039830187905260598320935061051b565b5f6104c4868c610b98565b809450819550829350505050604051935081860195506104e7848f60ff16610b91565b60c087811b600186015282811b600986015286901b6011850152601984018390526039840152605983018790526079832093505b5f8681526002602052604080822086905551859188917f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f9190a350505050505050505050505050565b8461058257604051636af2a73b60e11b815260040160405180910390fd5b836105a05760405163f9a9465f60e01b815260040160405180910390fd5b5f806105ac8989610a52565b5092509250508660035f6001846105c3919061154d565b81526020019081526020015f2054146105ef576040516347c5a1e560e01b815260040160405180910390fd5b5f818152600360205260409020541561061b5760405163092d315560e41b815260040160405180910390fd5b806001546001011461064057604051631d17cec760e21b815260040160405180910390fd5b60018190555f81815260036020908152604080832089905560048252918290208790558151888152908101879052839183917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a3505050505050505050565b806106c65760405163f9a9465f60e01b815260040160405180910390fd5b5f805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff541561070e5760405163c22a199f60e01b815260040160405180910390fd5b5f8061071a8585610a52565b5050915091505f61072f836011015160c01c90565b600984015160c01c600185015160c01c855160f81c010101905080156107685760405163f4f38de560e01b815260040160405180910390fd5b505f610775836019015190565b03610793576040516303d840a960e41b815260040160405180910390fd5b5f61079f836039015190565b146107bd57604051632781461960e11b815260040160405180910390fd5b5f8080527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b82905560036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8490556040518291907f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f908290a3604080518481525f60208201819052839290917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a35050505050565b81516030146108d45760405162461bcd60e51b815260206004820152601b60248201527f436f6d6d69746d656e74206d757374206265203438206279746573000000000060448201526064015b60405180910390fd5b805160301461091e5760405162461bcd60e51b815260206004820152601660248201527550726f6f66206d75737420626520343820627974657360501b60448201526064016108cb565b604080515f8049602083018190529290917f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff000000019101604051602081830303815290604052805190602001205f1c6109749190611560565b90505f828287878760405160200161099095949392919061157f565b60405160208183030381529060405290505f600a6001600160a01b0316826040516109bb9190611505565b5f60405180830381855afa9150503d805f81146109f3576040519150601f19603f3d011682016040523d82523d5f602084013e6109f8565b606091505b5050905080610a495760405162461bcd60e51b815260206004820152601960248201527f50726f6f6620766572696669636174696f6e206661696c65640000000000000060448201526064016108cb565b50505050505050565b5f808080853560f81c81818103610a8657610a6d8888610c4f565b80822060018301519298509650915060c01c9350610aa5565b610a908888610cc8565b80822060018301519298509650915060c01c93505b5f848152600260205260409020548514801590610aea57505f805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff5415155b15610b085760405163150e0a2160e11b815260040160405180910390fd5b601186015160c01c9250505092959194509250565b8051604080516020830281019091525f918291825b82811015610b7c575f80610b60888481518110610b5157610b516115b0565b6020026020010151878b610d39565b9085529889019895909501945050602090910190600101610b32565b50602091909102908190032094909350915050565b8082535050565b5f8049908060014983610bbe57604051630168f63160e21b815260040160405180910390fd5b8015610bdd57604051630148201960e11b815260040160405180910390fd5b508351604080516020830281019091525f5b82811015610c39575f80610c1d898481518110610c0e57610c0e6115b0565b6020026020010151878c610ec7565b908552998a019995909501945050602090910190600101610bef565b5060208202808183032094505050509250925092565b5f816059811015610c735760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f610c91836009015160c01c90565b905061010060ff8201046020026059018214610cc057604051630808452960e31b815260040160405180910390fd5b509250929050565b5f816079811015610cec5760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f610d0a836009015160c01c90565b905061010060ff8201046020026079018214610cc057604051630808452960e31b815260040160405180910390fd5b60405183515f91829160208701919081908490610d57908590610fc9565b90505f805b82811015610dca57603c81028601600181015185526021015165ffffffffffff19166020850152603a840193505f610d95603c836115c4565b610da08860016115db565b610daa91906115db565b90505f610dbb826038015160f01c90565b93909301925050600101610d5c565b5060200282016040525f6001603c83028601019050610dea6001866115db565b94505b8115610e84575f610e0286603a015160f01c90565b90505f610e13876038015160f01c90565b905081811015610e3657604051638c5a4ea360e01b815260040160405180910390fd5b815b81811015610e6357835160e01c60048086018290208852602090970196940190930192600101610e38565b505098890198978801979590950194603c94909401935f1990910190610ded565b895160208b019550610e96868361154d565b14610eb45760405163670241af60e01b815260040160405180910390fd5b5050819003902096919550909350505050565b60405183515f91829160208701919081908490610ee5908590611033565b90505f5b81811015610f5257603c81028501600181015184526021015165ffffffffffff19166020840152603a830192505f610f22603c836115c4565b610f2d8760016115db565b610f3791906115db565b90505f610f4382611094565b97909701965050600101610ee9565b506020850282016040526001840193505f5b8115610eb4575f610f7486611094565b9050835f610f81886110a3565b905082811015610fa457604051638c5a4ea360e01b815260040160405180910390fd5b9a82019a99820199603c97909701965f19949094019390850392909201910301610f64565b5f610fd5835160f81c90565b9050805f03610ff757604051631f18bc2360e21b815260040160405180910390fd5b611002603c826115c4565b61100d9060016115db565b82101561102d576040516302e3d2ef60e61b815260040160405180910390fd5b92915050565b5f61103d836110b2565b9050805f0361105f57604051631f18bc2360e21b815260040160405180910390fd5b61106a603c826115c4565b6110759060016115db565b821461102d576040516302e3d2ef60e61b815260040160405180910390fd5b5f61102d82603a015160f01c90565b5f61102d826038015160f01c90565b5f61102d825160f81c90565b5f8083601f8401126110ce575f80fd5b50813567ffffffffffffffff8111156110e5575f80fd5b6020830191508360208285010111156110fc575f80fd5b9250929050565b5f805f805f805f805f60c08a8c03121561111b575f80fd5b893567ffffffffffffffff80821115611132575f80fd5b61113e8d838e016110be565b909b50995060208c0135985060408c0135975060608c0135965060808c013591508082111561116b575f80fd5b6111778d838e016110be565b909650945060a08c013591508082111561118f575f80fd5b5061119c8c828d016110be565b915080935050809150509295985092959850929598565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156111f0576111f06111b3565b604052919050565b5f82601f830112611207575f80fd5b813567ffffffffffffffff811115611221576112216111b3565b611234601f8201601f19166020016111c7565b818152846020838601011115611248575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f805f8060808789031215611279575f80fd5b863560ff81168114611289575f80fd5b955060208781013567ffffffffffffffff808211156112a6575f80fd5b6112b28b838c016110be565b909850965060408a01359150808211156112ca575f80fd5b818a0191508a601f8301126112dd575f80fd5b8135818111156112ef576112ef6111b3565b8060051b6112fe8582016111c7565b918252838101850191858101908e841115611317575f80fd5b86860192505b83831015611350578483351115611332575f80fd5b6113418f8885358901016111f8565b8252918601919086019061131d565b985050505060608a0135925080831115611368575f80fd5b505061137689828a016110be565b979a9699509497509295939492505050565b5f60208284031215611398575f80fd5b5035919050565b5f805f805f805f60a0888a0312156113b5575f80fd5b873567ffffffffffffffff808211156113cc575f80fd5b6113d88b838c016110be565b909950975060208a0135965060408a0135955060608a0135945060808a0135915080821115611405575f80fd5b506114128a828b016110be565b989b979a50959850939692959293505050565b5f805f60408486031215611437575f80fd5b833567ffffffffffffffff81111561144d575f80fd5b611459868287016110be565b909790965060209590950135949350505050565b5f805f6060848603121561147f575f80fd5b83359250602084013567ffffffffffffffff8082111561149d575f80fd5b6114a9878388016111f8565b935060408601359150808211156114be575f80fd5b506114cb868287016111f8565b9150509250925092565b838152818360208301375f910160200190815292915050565b5f81518060208401855e5f93019283525090919050565b5f61151082846114ee565b9392505050565b5f8060408385031215611528575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561102d5761102d611539565b5f8261157a57634e487b7160e01b5f52601260045260245ffd5b500690565b8581528460208201528360408201525f6115a561159f60608401866114ee565b846114ee565b979650505050505050565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761102d5761102d611539565b8082018082111561102d5761102d61153956fea264697066735822122055e51824b54daf38f041f9435915b6f86b2be4ab4bd008b9b770fd79a4b96d4264736f6c6343000819003382fd20a056e33513eb7ecf8d739c368fd98588edd095c0f9e89ea767b03ebea68a39c755a042c69d1438eadcc442c8638056c2937f209f12944240dfb43d0d80a7526f9413
@colinlyguo colinlyguo added the T-bug Type: bug label May 9, 2024
@klkvr
Copy link
Member

klkvr commented May 11, 2024

Could you please share genesis.json anvil is initialized with?

@colinlyguo
Copy link
Author

Could you please share genesis.json anvil is initialized with?

{
	"config": {
		"chainId": 32382,
		"homesteadBlock": 0,
		"daoForkSupport": true,
		"eip150Block": 0,
		"eip155Block": 0,
		"eip158Block": 0,
		"byzantiumBlock": 0,
		"constantinopleBlock": 0,
		"petersburgBlock": 0,
		"istanbulBlock": 0,
		"muirGlacierBlock": 0,
		"berlinBlock": 0,
		"londonBlock": 0,
		"arrowGlacierBlock": 0,
		"grayGlacierBlock": 0,
		"shanghaiTime": 0,
		"cancunTime": 0,
		"terminalTotalDifficulty": 0,
		"terminalTotalDifficultyPassed": true
	},
	"nonce": "0x0",
	"timestamp": "0x65f40695",
	"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000123463a4b065722e99115d6c222f267d9cabb5240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
	"gasLimit": "0x1c9c380",
	"difficulty": "0x1",
	"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
	"coinbase": "0x0000000000000000000000000000000000000000",
	"alloc": {
		"1c5a77d9fa7ef466951b2f01f724bca3a5820b63": {
			"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
		},
		"33e0f539e31b35170faaa062af703b76a8282bf7": {
			"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
		},
		"1e32abcfe6db15c1570709e3fc02725335f50a47": {
			"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
		},
		"03a1bba60b5aa37094cf16123add674c01589488": {
			"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
		}
	},
	"number": "0x0",
	"gasUsed": "0x0",
	"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
	"baseFeePerGas": null,
	"excessBlobGas": null,
	"blobGasUsed": null
}

@klkvr
Copy link
Member

klkvr commented May 11, 2024

For me running anvil --init genesis.json and then cast public <tx payload> with tx payload you've provided results in successful tx inclusion, am I misunderstanding the issue?

@colinlyguo
Copy link
Author

For me running anvil --init genesis.json and then cast public <tx payload> with tx payload you've provided results in successful tx inclusion, am I misunderstanding the issue?

interesting. then the error may be returned by the Go SDK...

@ngotchac
Copy link
Contributor

Had the same issue, and we mostly see it (I think) using Go's go-ethereum lib since it does check for v, r, s validity when parsing a full block from RPC.

The bug was introduced here: 4a1ad3658#diff-bbb221c267c4e8729a42aafb229eb1119e229db1cfa531b4bf61b3e928cac341

by using

v: U256::from(t.signature().v().y_parity_byte())

for all the tx type variants, instead of the raw v value.

I'll try to make a PR to fix it

@zerosnacks zerosnacks added the C-anvil Command: anvil label Jun 27, 2024
@zerosnacks zerosnacks changed the title eth_sendRawTransaction returns invalid transaction v, r, s values bug(anvil): eth_sendRawTransaction returns invalid transaction v, r, s values Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants