-
Notifications
You must be signed in to change notification settings - Fork 10
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
Update the storage
solidity contract used in testing
#536
Conversation
WalkthroughThe pull request introduces significant modifications to a smart contract and its associated tests. Key changes include an increased gas limit for contract deployment, updates to the bytecode and Solidity contract to enhance functionality, and adjustments in expected values for various tests related to gas consumption and transaction fees. Additionally, new functions and events are added to the contract, improving its interactivity and logging capabilities. Changes
Possibly related PRs
Tip Announcements
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (7)
Additional comments not posted (38)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
tests/fixtures/storage.byte (1)
1-1
: Thoroughly review the significant changes to the smart contract bytecode.The bytecode changes indicate substantial modifications to the smart contract, including:
- Alterations to various function implementations
- Addition of new functions
- Modification of existing functions
- Changes in the logic of the contract
- Adjustments to state variable handling
- Introduction of new control flows
- Potential removal or replacement of certain operations
These changes likely affect the contract's logic, control flow, and interface, warranting a thorough review to ensure correctness and compatibility with existing systems.
- Carefully review each modified function to understand the changes in behavior and side effects.
- Analyze the impact of the changes on the contract's state management and overall functionality.
- Verify that the changes align with the intended design and requirements of the smart contract.
- Test the modified contract extensively to ensure it behaves as expected and maintains compatibility with dependent systems.
- Update relevant documentation to reflect the changes in the contract's interface and behavior.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- tests/e2e_web3js_test.go (1 hunks)
- tests/fixtures/storage.byte (1 hunks)
- tests/fixtures/storage.sol (3 hunks)
- tests/fixtures/storageABI.json (3 hunks)
- tests/web3js/eth_deploy_contract_and_interact_test.js (2 hunks)
- tests/web3js/eth_filter_endpoints_test.js (2 hunks)
- tests/web3js/eth_transaction_type_fees_test.js (4 hunks)
Additional comments not posted (38)
tests/fixtures/storage.sol (15)
7-7
: LGTM!The constant address
cadenceArch
is correctly declared and initialized.
8-8
: LGTM!The event
NewStore
is correctly declared with appropriate indexed parameters to log storage operations.
9-9
: LGTM!The event
Calculated
is correctly declared with appropriate indexed and non-indexed parameters to log calculation results.
23-26
: LGTM!The function
storeWithLog
is correctly implemented and enhances transparency by emitting theNewStore
event when a value is stored.
28-31
: LGTM!The function
storeButRevert
is correctly implemented and can be used to demonstrate a state change followed by a revert, which could be useful for testing error handling.
43-45
: LGTM!The view function
blockNumber
is correctly implemented and provides access to the current block number.
47-49
: LGTM!The view function
blockTime
is correctly implemented and provides access to the current block timestamp.
51-53
: LGTM!The view function
blockHash
is correctly implemented and provides access to the hash of a given block number.
55-57
: LGTM!The view function
random
is correctly implemented and provides access to the previous random number.
59-61
: LGTM!The view function
chainID
is correctly implemented and provides access to the current chain ID.
63-65
: LGTM!The function
destroy
is correctly implemented and can be used to terminate the contract and clean up any remaining funds.
75-80
: LGTM!The view function
verifyArchCallToRandomSource
is correctly implemented and can be used to interact with the external contract to retrieve a random source for a given block height.
82-87
: LGTM!The view function
verifyArchCallToRevertibleRandom
is correctly implemented and can be used to interact with the external contract to retrieve a revertible random number.
89-95
: LGTM!The view function
verifyArchCallToFlowBlockHeight
is correctly implemented and can be used to interact with the external contract to retrieve the Flow block height and verify that it matches the expected value.
97-103
: LGTM!The view function
verifyArchCallToVerifyCOAOwnershipProof
is correctly implemented and can be used to interact with the external contract to verify a COA ownership proof and verify that the result matches the expected value.tests/web3js/eth_transaction_type_fees_test.js (4)
70-70
: Verify the significant increase in coinbase balance.The assertion for
coinbaseBalance
has been updated from55585700n
to185858350n
, indicating a substantial increase in the coinbase balance after the transaction.Ensure that this change aligns with the expected behavior and is a result of intentional modifications to the transaction fees or the gas price.
24-24
: Verify the significant increase in gas used.The assertion for
rcp.gasUsed
has been updated from338798n
to1207193n
, indicating a substantial increase in the gas used for the transaction.Ensure that this change aligns with the expected behavior and is a result of intentional modifications to the contract or the blockchain environment.
30-30
: Verify the decrease in sender's balance.The assertion for
senderBalance
has been updated from4999999999949180300n
to4999999999818921050n
, indicating a decrease in the sender's balance after the transaction.Ensure that this change aligns with the expected behavior and is a result of intentional modifications to the transaction fees or the gas price.
Verification successful
Verified: The decrease in sender's balance is correct.
The change in the assertion for
senderBalance
from4999999999949180300n
to4999999999818921050n
accurately reflects the transaction cost, calculated using thegasUsed
andgasPrice
. This aligns with the expected behavior of the transaction.
- The
gasUsed
is1207193n
, and the transaction cost is calculated asres.receipt.gasUsed * gasPrice
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the sender balance change for the legacy transaction. # Test: Search for the legacy transaction and check the sender's balance before and after the transaction. # Expect: The balance difference should match the transaction cost (gasUsed * gasPrice). rg --type js -A 10 $'let res = await helpers.signAndSend'Length of output: 12185
Script:
#!/bin/bash # Description: Search for the gas used in the transaction within the eth_transaction_type_fees_test.js file. # Test: Look for the gas used in the transaction to verify the balance change. rg --type js -A 5 'gasUsed' tests/web3js/eth_transaction_type_fees_test.jsLength of output: 1414
Line range hint
127-225
: Verify the increase in coinbase balance.The assertion for
coinbaseBalance
has been updated from190368385n
to200403185n
, indicating an increase in the coinbase balance after the access list transaction.Ensure that this change aligns with the expected behavior and is a result of intentional modifications to the transaction fees or the gas price.
tests/web3js/eth_deploy_contract_and_interact_test.js (2)
236-236
: Verify the slight increase in gas estimate.The assertion for
gasEstimate
has been updated from27374n
to27442n
, indicating a slight increase in the estimated gas required for the operation.Ensure that this change aligns with the expected behavior and is a result of intentional modifications to the contract or the blockchain environment.
Verification successful
Verified: The increase in gas estimate is intentional.
The change in the gas estimate from
27374n
to27442n
aligns with recent updates to the storage contract used in testing. The commit history indicates modifications that likely impacted the gas estimation, confirming that the change is expected and intentional.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the gas estimate change for the contract interaction. # Test: Search for the contract interaction and check the gas estimate. # Expect: The gas estimate should match the updated assertion value. rg --type js -A 5 $'gasEstimate = await web3.eth.estimateGas'Length of output: 1165
Script:
#!/bin/bash # Check for recent changes in the contract code or configuration files that might affect gas estimation. # Find the contract file(s) being deployed in the test. rg --type js 'new web3.eth.Contract' -A 5 # Check the commit history for changes in the contract file(s) or configuration files. git log -p -n 5 -- tests/web3js/eth_deploy_contract_and_interact_test.jsLength of output: 14682
21-21
: Verify the significant increase in gas used for contract deployment.The assertion for
rcp.gasUsed
has been updated from338798n
to1207193n
, indicating a substantial increase in the gas used for the contract deployment transaction.Ensure that this change aligns with the expected behavior and is a result of intentional modifications to the contract or the blockchain environment.
tests/web3js/eth_filter_endpoints_test.js (2)
348-350
: LGTM!The change in the expected value of
txHashes[1]
is approved.
Line range hint
401-412
: LGTM!The changes in the expected transaction object properties are approved.
tests/fixtures/storageABI.json (14)
54-72
: LGTM!The
NewStore
event is correctly defined with appropriate parameter types.
80-98
: LGTM!The
blockHash
function is correctly defined with appropriate parameter and return types.
99-111
: LGTM!The
blockNumber
function is correctly defined with an appropriate return type.
112-124
: LGTM!The
blockTime
function is correctly defined with an appropriate return type.
125-137
: LGTM!The
cadenceArch
function is correctly defined with an appropriate return type.
138-150
: LGTM!The
chainID
function is correctly defined with an appropriate return type.
158-164
: LGTM!The
destroy
function is correctly defined.
165-177
: LGTM!The
random
function is correctly defined with an appropriate return type.
204-216
: LGTM!The
storeButRevert
function is correctly defined with an appropriate parameter type.
217-229
: LGTM!The
storeWithLog
function is correctly defined with an appropriate parameter type.
253-272
: LGTM!The
verifyArchCallToFlowBlockHeight
function is correctly defined with appropriate parameter and return types.
273-291
: LGTM!The
verifyArchCallToRandomSource
function is correctly defined with appropriate parameter and return types.
292-304
: LGTM!The
verifyArchCallToRevertibleRandom
function is correctly defined with an appropriate return type.
305-338
: LGTM!The
verifyArchCallToVerifyCOAOwnershipProof
function is correctly defined with appropriate parameter and return types.tests/e2e_web3js_test.go (1)
153-153
: Approve the gas limit increase, but verify the contract deployment.The gas limit increase for the contract deployment transaction is approved.
However, ensure that the contract deployment succeeds with this new gas limit.
Run the following script to verify the contract deployment:
Verification successful
Verification successful: Contract deployment with increased gas limit is tested.
The test includes a check for errors after the contract deployment transaction, ensuring that the deployment succeeds with the new gas limit.
- The line
require.NoError(t, err)
confirms that the deployment is expected to succeed, and the test will fail if it does not.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the contract deployment succeeds with the new gas limit. # Test: Search for the contract deployment transaction. Expect: A successful transaction. rg --type go -A 10 $'deployPayload, _, err := evmSign'Length of output: 826
Description
This will allow us to test stuff about precompiled calls and build a full-fledged EVM state.
For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Bug Fixes
Documentation