-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to add more context calls tests for the tload/tstore
- Loading branch information
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...es/dsl/transaction_storage_rskip446/tload_tstore_create_context_only_constructor_code.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
comment | ||
|
||
// CONTRACT CODE | ||
pragma solidity ^0.8.24; | ||
|
||
contract TestsTransientStorageCreateContextsOnlyConstructorCode { | ||
|
||
constructor() { | ||
bytes32 valueLoadedInitially; | ||
bytes32 valueLoadedAfterStore; | ||
assembly{ | ||
valueLoadedInitially := tload(0) | ||
tstore(0,0x0000000000000000000000000000000100000000000000000000000000000001) | ||
valueLoadedAfterStore := tload(0) | ||
} | ||
if(valueLoadedInitially == 0x00){ | ||
emit OK(); | ||
} else { | ||
emit ERROR(valueLoadedInitially); | ||
} | ||
|
||
if(valueLoadedAfterStore == 0x0000000000000000000000000000000100000000000000000000000000000001){ | ||
emit OK(); | ||
} else { | ||
emit ERROR(valueLoadedAfterStore); | ||
} | ||
} | ||
|
||
event OK(); | ||
event ERROR(bytes32); | ||
} | ||
|
||
// CONTRACT BYTECODE | ||
|
||
TestsTransientStorageCreateContextsOnlyConstructorCode: 608060405234801561000f575f80fd5b505f805f5c91507001000000000000000000000000000000015f5d5f5c90505f801b8203610068577fd48fe2800bace8f5ca2450feacbd6efc681b1cd0115019bb49fa529b6171bf6760405160405180910390a16100a0565b7f2fe0d3bd8bbb632441eefda46ec52f1ddda3a9e827d14c40f422037320f28bd9826040516100979190610142565b60405180910390a15b7001000000000000000000000000000000015f1b81036100eb577fd48fe2800bace8f5ca2450feacbd6efc681b1cd0115019bb49fa529b6171bf6760405160405180910390a1610123565b7f2fe0d3bd8bbb632441eefda46ec52f1ddda3a9e827d14c40f422037320f28bd98160405161011a9190610142565b60405180910390a15b505061015b565b5f819050919050565b61013c8161012a565b82525050565b5f6020820190506101555f830184610133565b92915050565b603e806101675f395ff3fe60806040525f80fdfea2646970667358221220c3c06d3ce43439437bdc0d04739df150a62dcb18dc5af99be6058c5c452435d964736f6c634300081a0033 | ||
|
||
end | ||
|
||
|
||
# Create and fund new account | ||
account_new acc1 10000000 | ||
|
||
# Create transaction to deploy TestTransientStorage contract | ||
transaction_build txTestTransientStorageContract | ||
sender acc1 | ||
receiverAddress 00 | ||
value 0 | ||
data 608060405234801561000f575f80fd5b505f805f5c91507001000000000000000000000000000000015f5d5f5c90505f801b8203610068577fd48fe2800bace8f5ca2450feacbd6efc681b1cd0115019bb49fa529b6171bf6760405160405180910390a16100a0565b7f2fe0d3bd8bbb632441eefda46ec52f1ddda3a9e827d14c40f422037320f28bd9826040516100979190610142565b60405180910390a15b7001000000000000000000000000000000015f1b81036100eb577fd48fe2800bace8f5ca2450feacbd6efc681b1cd0115019bb49fa529b6171bf6760405160405180910390a1610123565b7f2fe0d3bd8bbb632441eefda46ec52f1ddda3a9e827d14c40f422037320f28bd98160405161011a9190610142565b60405180910390a15b505061015b565b5f819050919050565b61013c8161012a565b82525050565b5f6020820190506101555f830184610133565b92915050565b603e806101675f395ff3fe60806040525f80fdfea2646970667358221220c3c06d3ce43439437bdc0d04739df150a62dcb18dc5af99be6058c5c452435d964736f6c634300081a0033 | ||
gas 1000000 | ||
build | ||
|
||
# Create block to hold txTestTransientStorageContract transaction | ||
block_build b01 | ||
parent g00 | ||
transactions txTestTransientStorageContract | ||
build | ||
|
||
# Connect block | ||
block_connect b01 | ||
|
||
# Check b01 is best block | ||
assert_best b01 |