Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianToledano committed Jan 22, 2025
2 parents b987bc6 + 9b56e7a commit 38b308f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ test:
test-system: build
mkdir -p ./tests/systemtests/binaries/
git clone https://github.com/cosmos/cosmos-sdk.git ./build/tmp/cosmos-sdk
cd ./build/tmp/cosmos-sdk && git checkout `grep -m 2 'github.com/cosmos/cosmos-sdk' ../../../go.mod | awk 'NR==2 {print $$4; exit} END{if(NR==1) print $$2}'`
$(eval SDK_VERSION := $(shell grep -m 2 'github.com/cosmos/cosmos-sdk' go.mod | awk 'NR==2 {print $$4; exit} END{if(NR==1) print $$2}'))
@echo "Checking out cosmos-sdk version: $(SDK_VERSION)"
cd ./build/tmp/cosmos-sdk && git checkout $(SDK_VERSION)
$(MAKE) -C ./build/tmp/cosmos-sdk build
cp ./build/tmp/cosmos-sdk/build/simd$(if $(findstring v2,$(COSMOS_BUILD_OPTIONS)),v2) ./tests/systemtests/binaries/
cp ./build/rosetta ./tests/systemtests/binaries/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ An implementation example can be found in `simapp` package.

To run Rosetta in your application CLI, use the following command:

> **Note:** if using the native approach, add your node name before any rosetta comand.
> **Note:** if using the native approach, add your node name before any rosetta command.
```shell
rosetta --help
Expand All @@ -74,7 +74,7 @@ rosetta

## Plugins - Multi chain connections

Rosetta will try to reflect the node types trough reflection over the node gRPC endpoints, there may be cases were this approach is not enough. It is possible to extend or implement the required types easily trough plugins.
Rosetta will try to reflect the node types trough reflection over the node gRPC endpoints, there may be cases were this approach is not enough. It is possible to extend or implement the required types easily through plugins.

To use Rosetta over any chain, it is required to set up prefixes and registering zone specific interfaces through plugins.

Expand Down
8 changes: 7 additions & 1 deletion tests/systemtests/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ func TestAccounts(t *testing.T) {
toAddr := cli.AddKey("account2")
sut.StartChain(t)

cli.RunAndWait("tx", "bank", "send", fromAddr, toAddr, "1000000stake")
rsp := cli.RunAndWait("tx", "bank", "send", fromAddr, toAddr, "1000000stake")
systemtests.RequireTxSuccess(t, rsp)

rosetta.restart(t)
rosettaRest := newRestClient(rosetta)
Expand All @@ -32,6 +33,11 @@ func TestAccounts(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, int64(8999999), gjson.GetBytes(res, "balances.0.value").Int())

// check recipient's balance after receiving tokens
res, err = rosettaRest.accountBalance(toAddr)
assert.NoError(t, err)
assert.Equal(t, int64(1000000), gjson.GetBytes(res, "balances.0.value").Int())

// check balance at genesis, before spent
res, err = rosettaRest.accountBalance(fromAddr, withBlockIdentifier("1"))
assert.NoError(t, err)
Expand Down
6 changes: 4 additions & 2 deletions tests/systemtests/rosetta.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (r *rosettaRunner) start(t *testing.T) {

r.log("Start Rosetta\n")
r.logf("Execute `%s %s`\n", r.execBinary, strings.Join(args, " "))
// #nosec G204
cmd := exec.Command(locateExecutable(r.execBinary), args...)
cmd.Dir = r.outputDir
r.watchLogs(cmd)
Expand All @@ -103,8 +104,9 @@ func (r *rosettaRunner) awaitRosettaUp(t *testing.T) {
SetBody("{}").
Post("/network/list")
if err == nil {
bk := gjson.GetBytes(res.Body(), "network_identifiers.#.blockchain").Array()[0].String()
require.Equal(t, bk, "testing")
result := gjson.GetBytes(res.Body(), "network_identifiers.#.blockchain").Array()
assert.Greater(t, len(result), 0)
require.Equal(t, result[0].String(), "testing")
t.Log("Rosetta has been started\n")
return
}
Expand Down
1 change: 1 addition & 0 deletions tests/systemtests/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func requireEnoughFileHandlers(nodesCount int) {
return
}

// #nosec G204
cmd := exec.Command(ulimit, "-n")
cmd.Dir = systemtests.WorkDir
out, err := cmd.CombinedOutput()
Expand Down

0 comments on commit 38b308f

Please sign in to comment.