Skip to content

Commit

Permalink
staging/0815: add aspect store v1 & fix bugs (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeNinjaX committed Nov 27, 2024
1 parent a151dbc commit a8c7cff
Show file tree
Hide file tree
Showing 90 changed files with 6,169 additions and 31,942 deletions.
2 changes: 1 addition & 1 deletion app/ante/evm/aspect_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
inherent "github.com/artela-network/aspect-core/chaincoreext/jit_inherent"

"github.com/artela-network/artela-rollkit/app/interfaces"
"github.com/artela-network/artela-rollkit/x/evm/artela/provider"
"github.com/artela-network/artela-rollkit/x/aspect/provider"
"github.com/artela-network/artela-rollkit/x/evm/artela/types"
"github.com/artela-network/artela-rollkit/x/evm/states"
evmmodule "github.com/artela-network/artela-rollkit/x/evm/types"
Expand Down
9 changes: 9 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,18 @@ import (
evmmodulekeeper "github.com/artela-network/artela-rollkit/x/evm/keeper"
"github.com/artela-network/artela-rollkit/x/evm/types"
feemodulekeeper "github.com/artela-network/artela-rollkit/x/fee/keeper"

// this line is used by starport scaffolding # stargate/app/moduleImport

"github.com/artela-network/artela-rollkit/docs"

// do not remove this, this will register the native evm tracers
_ "github.com/artela-network/artela-evm/tracers/native"
_ "github.com/ethereum/go-ethereum/eth/tracers/js"

// aspect related imports
_ "github.com/artela-network/artela-rollkit/x/aspect/store/v0"
_ "github.com/artela-network/artela-rollkit/x/aspect/store/v1"
)

const (
Expand Down
1 change: 0 additions & 1 deletion app/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type EVMKeeper interface {
VerifySig(ctx cosmos.Context, tx *ethereum.Transaction) (common.Address, []byte, error)
EVMConfigFromCtx(ctx cosmos.Context) (*states.EVMConfig, error)
GetBlockContext() *artvmtype.EthBlockContext
GetAspectRuntimeContext() *artvmtype.AspectRuntimeContext
MakeSigner(ctx cosmos.Context, tx *ethereum.Transaction, config *params.ChainConfig, blockNumber *big.Int, blockTime uint64) ethereum.Signer
}

Expand Down
53 changes: 0 additions & 53 deletions common/aspect/aspect_abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import (
"reflect"
"testing"

pq "github.com/emirpasic/gods/queues/priorityqueue"
"github.com/emirpasic/gods/sets/treeset"
"github.com/holiman/uint256"
jsoniter "github.com/json-iterator/go"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rlp"

"github.com/artela-network/artela-rollkit/x/evm/artela/types"
)

func TestAbi(t *testing.T) {
Expand Down Expand Up @@ -102,55 +98,6 @@ func TestPack(t *testing.T) {
fmt.Println(properties)
}

func TestAspectsOfPack(t *testing.T) {
ma := make(map[string]interface{}, 2)
ma[types.AspectIDMapKey] = "1111"
ma[types.VersionMapKey] = 0
ma[types.PriorityMapKey] = 1
mb := make(map[string]interface{}, 2)
mb[types.AspectIDMapKey] = "2222"
mb[types.VersionMapKey] = 1
mb[types.PriorityMapKey] = -10
mc := make(map[string]interface{}, 2)
mc[types.AspectIDMapKey] = "3333"
mc[types.VersionMapKey] = 2
mc[types.PriorityMapKey] = 3

queue := pq.NewWith(types.ByMapKeyPriority) // empty
queue.Enqueue(ma) // {a 1}
queue.Enqueue(mb) // {c 3}, {a 1}
queue.Enqueue(mc)

outputs := make([]types.AspectMeta, 0)
iterator := queue.Iterator()

for iterator.Next() {
m := iterator.Value().(map[string]interface{})
e := types.AspectMeta{
Id: common.HexToAddress(m[types.AspectIDMapKey].(string)),
Priority: int64(m[types.PriorityMapKey].(int)),
Version: uint256.NewInt(m[types.VersionMapKey].(uint64)),
}
outputs = append(outputs, e)
}
pack, err := methods["AspectsOf"].Outputs.Pack(outputs)
if err != nil {
fmt.Println("pack error", err)
}
maps := make(map[string]interface{}, 0)
err2 := methods["AspectsOf"].Outputs.UnpackIntoMap(maps, pack)
if err2 != nil {
fmt.Println("pack error", err2)
}
fmt.Println("unpack==", maps)
aspects := maps["aspectBoundInfo"].([]struct {
AspectId common.Address `json:"AspectId"`
Version uint64 `json:"Version"`
Priority int8 `json:"Priority"`
})
fmt.Println(aspects)
}

func TestContractOfPack(t *testing.T) {
treeset := treeset.NewWithStringComparator()
treeset.Add("aaaaaaa")
Expand Down
Loading

0 comments on commit a8c7cff

Please sign in to comment.