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

Add currency exchange rates to BlockContext #24

Merged
merged 5 commits into from
Oct 16, 2023

Conversation

karlb
Copy link

@karlb karlb commented Oct 11, 2023

I did not add currency specific base fees, as these are implied by the CELO base fee and the exchange rate.

The FeeCurrency is from the unmerged and untested celo-org/optimism#71, but I wanted to include all necessary contracts in one go. We can easily update it later.

The manual initialization of contracts in core/celo_genesis.go is a bit fiddly, but IMO still better than pulling in additional tooling.

Since the fee currency support is incomplete, the e2e testing does not actually test anything at the moment. It provides good examples what to run to check the partial support, though.

Closes celo-org/optimism#58

@karlb karlb force-pushed the karlb/fee-currency-exchange-rates branch from 8fc76b1 to f6e145e Compare October 11, 2023 14:50
@karlb karlb marked this pull request as ready for review October 11, 2023 15:35
core/celo_evm.go Outdated Show resolved Hide resolved
core/celo_evm.go Outdated Show resolved Hide resolved
@@ -49,7 +56,27 @@ func celoGenesisAccounts() map[common.Address]GenesisAccount {
if err != nil {
panic(err)
}
sortedOraclesBytecodeLinked := bytes.Replace(contracts.SortedOraclesBytecodeRaw, []byte("__$c0b499b413513d0c67e2a6a17d90846cb3$__"), []byte("000000000000000000000000000000000000ce17"), -1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we have to adapt this every time the bytecode changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I failed at looking up that information. I assume it is something stable like keccak("AddressSortedLinkedListWithMedian") to get a fixed length placeholder.

Celo specific changes should be in separate files from the upstream code
wherever possible.

Also check for Cel2 flag.
@karlb karlb force-pushed the karlb/fee-currency-exchange-rates branch from f6e145e to f7fdfb3 Compare October 13, 2023 14:44
@karlb karlb force-pushed the karlb/fee-currency-exchange-rates branch from f7fdfb3 to 13cec5b Compare October 16, 2023 12:39
Copy link

@palango palango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@karlb karlb merged commit 951ff88 into celo2 Oct 16, 2023
2 of 5 checks passed
@karlb karlb deleted the karlb/fee-currency-exchange-rates branch October 16, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add BaseGasPrice and exchange rates per currency to block context
2 participants