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

evm: Upgradeable contracts #2476

Merged
merged 40 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
81f513f
Add Proxy contract
shohamc1 Sep 21, 2023
c7c3585
change to using unstructured pattern
Sep 21, 2023
9edb873
make changes to intrinsics
Sep 21, 2023
4420d58
Add proxy to transferdomain
shohamc1 Sep 21, 2023
26a93de
Fix build, add newlines
shohamc1 Sep 21, 2023
3cd96ab
Add intrinsics registry deployment
shohamc1 Sep 21, 2023
3a5fcb7
Fix slot number
shohamc1 Sep 21, 2023
215ba47
Merge branch 'master' into evm/upgradeable-contracts
shohamc1 Sep 21, 2023
b286797
Make DST20 proxy upgradeable
shohamc1 Sep 21, 2023
a9b5674
Fix bridge_dst20
shohamc1 Sep 21, 2023
f57f22f
Fix warnings
shohamc1 Sep 21, 2023
4d0c01b
Add license to new contracts
shohamc1 Sep 21, 2023
653fda9
Add old asserts
shohamc1 Sep 21, 2023
1246b8c
Rename TRANSFERDOMAIN_PROXY to PROXY
shohamc1 Sep 21, 2023
5b89911
add example DFIIntrinsics Usage
Sep 21, 2023
741ab4a
fix bug and rename variable
Sep 21, 2023
124c865
change the example to using DFIRegistry
Sep 21, 2023
25b3434
move exampledfiintrinsics to test folder
Sep 21, 2023
1642204
remove import
Sep 21, 2023
3a799dc
Fix test
shohamc1 Sep 22, 2023
848eceb
Merge remote-tracking branch 'origin/master' into evm/upgradeable-con…
shohamc1 Sep 22, 2023
4176e50
Format Python files
shohamc1 Sep 22, 2023
048da38
Fix clippy warnings
shohamc1 Sep 22, 2023
7572e83
Add newlines to end of file
shohamc1 Sep 22, 2023
35dc361
Remove unused imports
shohamc1 Sep 22, 2023
21ab11b
Test intrinsics via contract
shohamc1 Sep 22, 2023
3aa8078
Rename registry functions, update example integration
shohamc1 Sep 22, 2023
be2ee41
Split Proxy deployments
shohamc1 Sep 22, 2023
55a2107
Merge branch 'master' into evm/upgradeable-contracts
prasannavl Sep 25, 2023
25938c2
Reorg with conventions, cleanup
prasannavl Sep 25, 2023
da93bac
Finish missing changes
prasannavl Sep 25, 2023
cf02329
Fix tests
prasannavl Sep 25, 2023
6a05071
Adhere to conventions
prasannavl Sep 25, 2023
7eab71b
Transparent TX for DST20 implementation
shohamc1 Sep 25, 2023
78ffbf4
Construct implementation slot from bytes
shohamc1 Sep 25, 2023
4ac654e
Fix typo
shohamc1 Sep 25, 2023
b078655
Fix typo
shohamc1 Sep 25, 2023
c4a1518
Fix tests
shohamc1 Sep 25, 2023
dab2d85
Add address in comments
shohamc1 Sep 25, 2023
d5d3839
Add comments to test
shohamc1 Sep 25, 2023
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
7 changes: 4 additions & 3 deletions lib/ain-contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ pub type Result<T> = std::result::Result<T, anyhow::Error>;

pub const DST20_ADDR_PREFIX_BYTE: u8 = 0xff;
pub const INTRINSICS_ADDR_PREFIX_BYTE: u8 = 0xdf;

pub const IMPLEMENTATION_SLOT: H256 = H256([
shohamc1 marked this conversation as resolved.
Show resolved Hide resolved
0x36, 0x08, 0x94, 0xa1, 0x3b, 0xa1, 0xa3, 0x21, 0x06, 0x67, 0xc8, 0x28, 0x49, 0x2d, 0xb9, 0x8d,
0xca, 0x3e, 0x20, 0x76, 0xcc, 0x37, 0x35, 0xa9, 0x20, 0xa3, 0xca, 0x50, 0x5d, 0x38, 0x2b, 0xbc,
]);
macro_rules! solc_artifact_path {
($project_name:literal, $artifact:literal) => {
concat!(
Expand Down Expand Up @@ -103,8 +106,6 @@ pub struct FixedContract {
}

lazy_static::lazy_static! {
pub static ref IMPLEMENTATION_SLOT: H256 = H256::from_str("0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc").unwrap();

pub static ref DFI_RESERVED_CONTRACT: Contract = {
let bytecode = solc_artifact_bytecode_str!(
"dfi_reserved",
Expand Down
4 changes: 2 additions & 2 deletions lib/ain-evm/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub fn transfer_domain_deploy_info(implementation_address: H160) -> Result<Deplo
Ok(DeployContractInfo {
address: fixed_address,
bytecode: Bytes::from(contract.runtime_bytecode),
storage: vec![(*IMPLEMENTATION_SLOT, h160_to_h256(implementation_address))],
storage: vec![(IMPLEMENTATION_SLOT, h160_to_h256(implementation_address))],
})
}

Expand Down Expand Up @@ -185,7 +185,7 @@ pub fn dst20_deploy_info(
(H256::from_low_u64_be(3), get_abi_encoded_string(name)),
(H256::from_low_u64_be(4), get_abi_encoded_string(symbol)),
(
*IMPLEMENTATION_SLOT,
IMPLEMENTATION_SLOT,
h160_to_h256(get_dst20_v1_contract().fixed_address),
),
];
Expand Down