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

Fix InvalidTransaction: BaseFeeTooHigh by modifying the parsing for transactions #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Conform/TestParser.lean
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,14 @@ instance : FromJson Transaction where
dbgSender := ← json.getObjValAsD! AccountAddress "sender"
}

match json.getObjVal? "v" with
| .ok w => do
return .legacy ⟨baseTransaction, ⟨← json.getObjValAsD! UInt256 "gasPrice"⟩, ← FromJson.fromJson? w⟩
| .error _ => do
match json.getObjVal? "accessList" with
| .ok A => do
-- Any other transaction now necessarily has an access list.
let accessListTransaction : Transaction.WithAccessList :=
{
chainId := let mainnet : Nat := 1; mainnet
accessList := ← json.getObjValAsD! _ "accessList" <&> accessListToRBMap
yParity := TODO
accessList := ← FromJson.fromJson? A <&> accessListToRBMap
yParity := ← json.getObjValAsD! UInt256 "v"
}

match json.getObjVal? "gasPrice" with
Expand All @@ -184,6 +182,8 @@ instance : FromJson Transaction where
← json.getObjValAsD! UInt256 "maxFeePerGas",
← json.getObjValAsD! UInt256 "maxPriorityFeePerGas"
| .error _ => do
return .legacy ⟨baseTransaction, ⟨← json.getObjValAsD! UInt256 "gasPrice"⟩, (← json.getObjValAsD! UInt256 "v")⟩

where accessListToRBMap (this : AccessList) : Batteries.RBMap AccountAddress (Array UInt256) compare :=
this.foldl (init := ∅) λ m ⟨addr, list⟩ ↦ m.insert addr list
Expand Down