Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f8e7ff5
Updated go version, flow-go, crypto packages, removed relic
UlyanaAndrukhiv May 1, 2024
d72e0ee
Updated localnet configs, fixed localnet integration test
UlyanaAndrukhiv May 20, 2024
a21feed
Updated integration test
UlyanaAndrukhiv May 20, 2024
69750ec
Removed unnecessary comments
UlyanaAndrukhiv May 20, 2024
a265464
Returned back staticcheck for lint, updated const json formatting
UlyanaAndrukhiv May 22, 2024
4fe3dec
Updated formatting for localnet_const
UlyanaAndrukhiv May 22, 2024
bbf530f
Updated flow-go to v0.35.8
UlyanaAndrukhiv May 23, 2024
1534d72
Fixed payload hash calculating
UlyanaAndrukhiv May 24, 2024
69924e3
Added data folder removing before rosetta server build
UlyanaAndrukhiv May 24, 2024
5706d3c
Updated events fields parsing for indexing
UlyanaAndrukhiv May 27, 2024
354d85a
Added previewnet configs for rosetta, disabled outdated canary network
UlyanaAndrukhiv May 27, 2024
beaadb5
Updated parsing cadence values according to version 1.0
UlyanaAndrukhiv May 28, 2024
0eb8edb
Added previewnet config for rosetta
UlyanaAndrukhiv May 28, 2024
6c393ef
Updated localnet integration test
UlyanaAndrukhiv May 28, 2024
3607503
Updated scripts to Cadence 1.0
UlyanaAndrukhiv May 28, 2024
8a42e71
Updated basic-transfer transaction to Cadence 1.0
UlyanaAndrukhiv May 28, 2024
f325fc5
Added previewnet integration test, updated templates for Cadence scri…
UlyanaAndrukhiv May 28, 2024
0e2d49e
Added previewnet-integration-test command to makefile
UlyanaAndrukhiv May 28, 2024
5019703
Removed unused imports for previewnwt integration test, updated comma…
UlyanaAndrukhiv May 29, 2024
d724b4a
Merged with main
UlyanaAndrukhiv May 29, 2024
df294a2
Updated according to comment
UlyanaAndrukhiv May 29, 2024
cca69b1
Updated according to suggested comments
UlyanaAndrukhiv May 29, 2024
1c9eab4
Removed unused import from test, updated cmd formatting
UlyanaAndrukhiv May 29, 2024
da693fb
Updated according to comment, removed unnecessary temporary convertEx…
UlyanaAndrukhiv May 30, 2024
775884c
Updated scripts for proxy contract according to comments
UlyanaAndrukhiv Jun 4, 2024
0216b7d
Removed canary net and added Previewnet
Jul 15, 2024
f82615a
Updated dependencies and fixed method change from cadence.event.GetFi…
Jul 16, 2024
f180322
Made contents of script.go consistent with other Cadence 1.0 script c…
Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

all: build

relic:
./environ/build-relic.py

go-build:
go build -tags relic -o server cmd/server/server.go
go build -o server cmd/server/server.go

build: relic go-build
build: go-build

deps:
go mod download -x

lint:
@go mod tidy
@staticcheck -tags relic ./...
Comment thread
UlyanaAndrukhiv marked this conversation as resolved.
@staticcheck ./...

proto:
@echo ">> Generating model/model.pb.go"
Expand All @@ -29,4 +26,7 @@ integration-test-cleanup:
rm -rf flow-go

integration-test:
python3 integration_test.py
python3 integration_test.py

previewnet-integration-test:
python3 previewnet_integration_test.py
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ config file:
mode. During offline mode, only certain Rosetta API endpoints are
functional.

* `network: "mainnet" | "testnet" | "canary" | "localnet"`
* `network: "mainnet" | "testnet" | "previewnet" | "localnet"`

* This defines the specific Flow chain that is being used.

Expand Down Expand Up @@ -613,7 +613,8 @@ transaction(sender: Address, receiver: Address, amount: UFix64, nonce: Int64, si
    execute {
        // Get a reference to the sender's FlowColdStorageProxy Vault.
        let acct = getAccount(sender)
        let vault = acct.getCapability(FlowColdStorageProxyVault.VaultCapabilityPublicPath).borrow<&FlowColdStorageProxy.Vault>()!
        let vault = acct.capabilities.borrow<&{FlowColdStorageProxy.Vault}>(FlowColdStorageProxy.VaultCapabilityPublicPath)!


        // Transfer tokens to the receiver.
        vault.transfer(receiver: receiver, amount: amount, nonce: nonce, sig: sig.decodeHex())
Expand Down Expand Up @@ -1621,8 +1622,7 @@ transaction(receiver: Address, amount: UFix64) {
}
execute {
let receiver = getAccount(receiver)
.getCapability(/public/flowTokenReceiver)
.borrow<&{FungibleToken.Receiver}>()!
.capabilities.borrow<&{FungibleToken.Receiver}>(/public/flowTokenReceiver)!
receiver.deposit(from: <-self.xfer)
}
}
Expand Down
7 changes: 4 additions & 3 deletions access/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ import (
"crypto/x509"
"encoding/hex"
"fmt"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"math/rand"
"strconv"
"strings"
"time"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls"
"github.com/onflow/cadence"
jsoncdc "github.com/onflow/cadence/encoding/json"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/flow-go/crypto"
"github.com/onflow/crypto"
"github.com/onflow/flow-go/network/p2p/keyutils"
"github.com/onflow/flow/protobuf/go/flow/access"
"github.com/onflow/flow/protobuf/go/flow/entities"
Expand Down
2 changes: 1 addition & 1 deletion api/account_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s *Server) getSequenceNumber(ctx context.Context, addr []byte, block *mode
if err != nil {
return 0, err
}
nonce, ok := resp.ToGoValue().(int64)
nonce, ok := resp.(cadence.Int64)
if !ok {
return 0, fmt.Errorf("failed to convert get_proxy_nonce result to int64")
}
Expand Down
24 changes: 14 additions & 10 deletions api/call_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (s *Server) accountPublicKeys(ctx context.Context, params map[string]interf
if err != nil {
return nil, handleExecutionErr(err, "execute get_proxy_public_key")
}
rawKey, ok := resp.ToGoValue().(string)
rawKey, ok := resp.(cadence.String)
if !ok {
return nil, wrapErrorf(
errInternal, "failed to convert get_proxy_public_key result to string",
Expand All @@ -146,7 +146,7 @@ func (s *Server) accountPublicKeys(ctx context.Context, params map[string]interf
len(keys),
)
}
pub, err := hex.DecodeString(rawKey)
pub, err := hex.DecodeString(string(rawKey))
if err != nil {
return nil, wrapErrorf(
errInternal,
Expand Down Expand Up @@ -246,14 +246,15 @@ func (s *Server) getOnchainData(ctx context.Context, addr []byte, block []byte)
if err != nil {
return nil, handleExecutionErr(err, "execute "+scriptName)
}
fields, ok := resp.ToGoValue().([]interface{})
structValue, ok := resp.(cadence.Struct)
if !ok {
return nil, wrapErrorf(
errInternal,
"failed to convert %s result to Go slice",
"failed to convert %s result to array",
scriptName,
)
}
fields := cadence.FieldsMappedByName(structValue)
if len(fields) != 3 {
return nil, wrapErrorf(
errInternal,
Expand All @@ -262,30 +263,33 @@ func (s *Server) getOnchainData(ctx context.Context, addr []byte, block []byte)
)
}
onchain := &onchainData{}
onchain.DefaultBalance, ok = fields[0].(uint64)
defaultBalance, ok := fields["default_balance"].(cadence.UFix64)
if !ok {
return nil, wrapErrorf(
errInternal,
"expected first field of the %s result to be uint64: got %T",
scriptName, fields[0],
scriptName, fields["default_balance"],
)
}
onchain.IsProxy, ok = fields[1].(bool)
onchain.DefaultBalance = uint64(defaultBalance)
isProxy, ok := fields["is_proxy"].(cadence.Bool)
if !ok {
return nil, wrapErrorf(
errInternal,
"expected second field of the %s result to be bool: got %T",
scriptName, fields[1],
scriptName, fields["is_proxy"],
)
}
onchain.ProxyBalance, ok = fields[2].(uint64)
onchain.IsProxy = bool(isProxy)
proxyBalance, ok := fields["proxy_balance"].(cadence.UFix64)
if !ok {
return nil, wrapErrorf(
errInternal,
"expected third field of the %s result to be uint64: got %T",
scriptName, fields[2],
scriptName, fields["proxy_balance"],
)
}
onchain.ProxyBalance = uint64(proxyBalance)
return onchain, nil
}

Expand Down
Loading