Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Update Godwoken in integration-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Flouse authored and jjyr committed Jan 17, 2022
1 parent a3892bb commit 165547a
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 31 deletions.
2 changes: 1 addition & 1 deletion devtools/ci/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else
git clone -b develop https://github.com/nervosnetwork/godwoken.git $GODWOKEN_DIR
fi
cd $GODWOKEN_DIR
git checkout 1dc4092926291542b76f4f80883f5c6959992510 # https://github.com/nervosnetwork/godwoken/commits/1dc4092
git checkout 7527776abf53ab069015b66e2569148341425bd8 # https://github.com/nervosnetwork/godwoken/commits/7527776a
git submodule update --init --recursive --depth=1

cd $PROJECT_ROOT
Expand Down
7 changes: 4 additions & 3 deletions polyjuice-tests/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pub use gw_generator::{
traits::StateExt,
Generator,
};
use gw_store::traits::KVStore;
use gw_store::traits::chain_store::ChainStore;
use gw_store::traits::kv_store::KVStoreWrite;
pub use gw_store::{chain_view::ChainView, Store};
use gw_traits::CodeStore;
use gw_types::offchain::RollupContext;
Expand Down Expand Up @@ -501,7 +502,7 @@ pub fn deploy(
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down Expand Up @@ -570,7 +571,7 @@ pub fn simple_storage_get(
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/call_multiple_times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin");
Expand Down Expand Up @@ -140,7 +141,7 @@ fn test_call_multiple_times() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
7 changes: 4 additions & 3 deletions polyjuice-tests/src/test_cases/call_selfdestruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const SD_INIT_CODE: &str = include_str!("./evm-contracts/SelfDestruct.bin");
Expand Down Expand Up @@ -133,7 +134,7 @@ fn test_selfdestruct() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down Expand Up @@ -186,7 +187,7 @@ fn test_selfdestruct() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let result = generator.execute_transaction(
&ChainView::new(&db, tip_block_hash),
&state,
Expand Down Expand Up @@ -218,7 +219,7 @@ fn test_selfdestruct() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let result = generator.execute_transaction(
&ChainView::new(&db, tip_block_hash),
&state,
Expand Down
5 changes: 3 additions & 2 deletions polyjuice-tests/src/test_cases/contract_call_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin");
Expand Down Expand Up @@ -116,7 +117,7 @@ fn test_contract_call_contract() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down Expand Up @@ -210,7 +211,7 @@ fn test_contract_call_non_exists_contract() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/contract_create_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/CreateContract.bin");
Expand Down Expand Up @@ -82,7 +83,7 @@ fn test_contract_create_contract() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/create2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin");
Expand Down Expand Up @@ -90,7 +91,7 @@ fn test_create2() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/delegatecall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin");
Expand Down Expand Up @@ -121,7 +122,7 @@ fn test_delegatecall() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/ecrecover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/HeadTail.bin");
Expand Down Expand Up @@ -83,7 +84,7 @@ fn test_ecrecover() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/ERC20.bin");
Expand Down Expand Up @@ -158,7 +159,7 @@ fn test_erc20() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/eth_to_godwoken_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{
bytes::Bytes,
core::ScriptHashType,
Expand Down Expand Up @@ -81,7 +82,7 @@ fn test_eth_to_godwoken_addr() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/fallback_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/FallbackFunction.bin");
Expand Down Expand Up @@ -88,7 +89,7 @@ fn test_fallback_function() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
5 changes: 3 additions & 2 deletions polyjuice-tests/src/test_cases/get_block_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use gw_common::state::State;
use gw_db::schema::COLUMN_INDEX;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::KVStore;
use gw_store::traits::chain_store::ChainStore;
use gw_store::traits::kv_store::KVStoreWrite;
use gw_types::{
bytes::Bytes,
packed::{RawL2Transaction, Uint64},
Expand Down Expand Up @@ -138,7 +139,7 @@ fn test_get_block_info() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/get_chain_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/GetChainId.bin");
Expand Down Expand Up @@ -92,7 +93,7 @@ fn test_get_chain_id() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/heap_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const MEMORY_INIT_CODE: &str = include_str!("./evm-contracts/Memory.bin");
Expand Down Expand Up @@ -106,7 +107,7 @@ fn test_heap_momory() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let err = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/invalid_sudt_erc20_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::{error::TransactionError, traits::StateExt};
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INVALID_SUDT_ERC20_PROXY_CODE: &str =
Expand Down Expand Up @@ -158,7 +159,7 @@ fn test_invalid_sudt_erc20_proxy() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let result = generator.execute_transaction(
&ChainView::new(&db, tip_block_hash),
&state,
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/parse_log_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/LogEvents.bin");
Expand Down Expand Up @@ -169,7 +170,7 @@ fn test_parse_log_event() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/recover_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::{error::TransactionError, traits::StateExt};
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{
bytes::Bytes,
core::ScriptHashType,
Expand Down Expand Up @@ -183,7 +184,7 @@ fn test_recover_account() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let err = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
3 changes: 2 additions & 1 deletion polyjuice-tests/src/test_cases/recursion_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::{error::TransactionError, traits::StateExt};
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const RECURSION_INIT_CODE: &str = include_str!("./evm-contracts/RecursionContract.bin");
Expand Down Expand Up @@ -168,7 +169,7 @@ fn test_recursion_contract_call() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let err = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down
5 changes: 3 additions & 2 deletions polyjuice-tests/src/test_cases/selfdestruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::helper::{
use gw_common::state::State;
use gw_generator::traits::StateExt;
use gw_store::chain_view::ChainView;
use gw_store::traits::chain_store::ChainStore;
use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*};

const INIT_CODE: &str = include_str!("./evm-contracts/SelfDestruct.bin");
Expand Down Expand Up @@ -110,7 +111,7 @@ fn test_selfdestruct() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let run_result = generator
.execute_transaction(
&ChainView::new(&db, tip_block_hash),
Expand Down Expand Up @@ -153,7 +154,7 @@ fn test_selfdestruct() {
.args(Bytes::from(args).pack())
.build();
let db = store.begin_transaction();
let tip_block_hash = store.get_tip_block_hash().unwrap();
let tip_block_hash = db.get_tip_block_hash().unwrap();
let result = generator.execute_transaction(
&ChainView::new(&db, tip_block_hash),
&state,
Expand Down
Loading

0 comments on commit 165547a

Please sign in to comment.