2018-04-09 08:18:22 +00:00
|
|
|
package transactions
|
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
//go:generate mockgen -package=mock_transactor -source=transactor.go -destination=mock/transactor.go
|
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
import (
|
2018-08-16 11:37:53 +00:00
|
|
|
"bytes"
|
2018-04-09 08:18:22 +00:00
|
|
|
"context"
|
2019-03-01 13:49:30 +00:00
|
|
|
"errors"
|
2019-02-15 11:31:20 +00:00
|
|
|
"fmt"
|
2018-04-09 08:18:22 +00:00
|
|
|
"math/big"
|
|
|
|
"time"
|
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
ethereum "github.com/ethereum/go-ethereum"
|
2019-12-19 18:27:27 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2019-02-21 09:53:39 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
2019-11-23 17:57:05 +00:00
|
|
|
gethtypes "github.com/ethereum/go-ethereum/core/types"
|
2018-04-09 08:18:22 +00:00
|
|
|
|
2018-06-08 11:29:50 +00:00
|
|
|
"github.com/status-im/status-go/account"
|
2019-12-19 18:27:27 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/crypto"
|
2019-11-23 17:57:05 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
"github.com/status-im/status-go/logutils"
|
2023-11-02 11:35:28 +00:00
|
|
|
"github.com/status-im/status-go/params"
|
2018-06-08 11:29:50 +00:00
|
|
|
"github.com/status-im/status-go/rpc"
|
2024-03-12 09:15:30 +00:00
|
|
|
"github.com/status-im/status-go/services/wallet/bigint"
|
|
|
|
wallet_common "github.com/status-im/status-go/services/wallet/common"
|
2018-04-09 08:18:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// sendTxTimeout defines how many seconds to wait before returning result in sentTransaction().
|
2018-04-10 10:02:54 +00:00
|
|
|
sendTxTimeout = 300 * time.Second
|
2018-04-09 08:18:22 +00:00
|
|
|
|
|
|
|
defaultGas = 90000
|
2019-03-01 13:49:30 +00:00
|
|
|
|
2023-09-29 17:56:27 +00:00
|
|
|
ValidSignatureSize = 65
|
2018-04-09 08:18:22 +00:00
|
|
|
)
|
|
|
|
|
2019-03-01 13:49:30 +00:00
|
|
|
// ErrInvalidSignatureSize is returned if a signature is not 65 bytes to avoid panic from go-ethereum
|
|
|
|
var ErrInvalidSignatureSize = errors.New("signature size must be 65")
|
|
|
|
|
2019-02-15 11:31:20 +00:00
|
|
|
type ErrBadNonce struct {
|
2019-02-21 09:53:39 +00:00
|
|
|
nonce uint64
|
|
|
|
expectedNonce uint64
|
2019-02-15 11:31:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *ErrBadNonce) Error() string {
|
2019-02-21 09:53:39 +00:00
|
|
|
return fmt.Sprintf("bad nonce. expected %d, got %d", e.expectedNonce, e.nonce)
|
2019-02-15 11:31:20 +00:00
|
|
|
}
|
|
|
|
|
2024-05-26 08:31:13 +00:00
|
|
|
// Transactor is an interface that defines the methods for validating and sending transactions.
|
|
|
|
type TransactorIface interface {
|
2024-06-27 21:27:09 +00:00
|
|
|
NextNonce(rpcClient rpc.ClientInterface, chainID uint64, from types.Address) (uint64, error)
|
2024-05-26 08:31:13 +00:00
|
|
|
EstimateGas(network *params.Network, from common.Address, to common.Address, value *big.Int, input []byte) (uint64, error)
|
2024-08-12 12:07:32 +00:00
|
|
|
SendTransaction(sendArgs SendTxArgs, verifiedAccount *account.SelectedExtKey, lastUsedNonce int64) (hash types.Hash, nonce uint64, err error)
|
|
|
|
SendTransactionWithChainID(chainID uint64, sendArgs SendTxArgs, lastUsedNonce int64, verifiedAccount *account.SelectedExtKey) (hash types.Hash, nonce uint64, err error)
|
|
|
|
ValidateAndBuildTransaction(chainID uint64, sendArgs SendTxArgs, lastUsedNonce int64) (tx *gethtypes.Transaction, nonce uint64, err error)
|
2024-05-26 08:31:13 +00:00
|
|
|
AddSignatureToTransaction(chainID uint64, tx *gethtypes.Transaction, sig []byte) (*gethtypes.Transaction, error)
|
|
|
|
SendRawTransaction(chainID uint64, rawTx string) error
|
|
|
|
BuildTransactionWithSignature(chainID uint64, args SendTxArgs, sig []byte) (*gethtypes.Transaction, error)
|
|
|
|
SendTransactionWithSignature(from common.Address, symbol string, multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) (hash types.Hash, err error)
|
2024-07-08 09:02:06 +00:00
|
|
|
StoreAndTrackPendingTx(from common.Address, symbol string, chainID uint64, multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) error
|
2024-05-26 08:31:13 +00:00
|
|
|
}
|
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
// Transactor validates, signs transactions.
|
|
|
|
// It uses upstream to propagate transactions to the Ethereum network.
|
|
|
|
type Transactor struct {
|
2022-06-09 13:09:56 +00:00
|
|
|
rpcWrapper *rpcWrapper
|
2024-03-12 09:15:30 +00:00
|
|
|
pendingTracker *PendingTxTracker
|
2022-06-09 13:09:56 +00:00
|
|
|
sendTxTimeout time.Duration
|
|
|
|
rpcCallTimeout time.Duration
|
|
|
|
networkID uint64
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
logger *zap.Logger
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewTransactor returns a new Manager.
|
2018-08-16 11:37:53 +00:00
|
|
|
func NewTransactor() *Transactor {
|
2018-04-09 08:18:22 +00:00
|
|
|
return &Transactor{
|
2018-08-16 11:37:53 +00:00
|
|
|
sendTxTimeout: sendTxTimeout,
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
logger: logutils.ZapLogger().Named("transactor"),
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:15:30 +00:00
|
|
|
// SetPendingTracker sets a pending tracker.
|
|
|
|
func (t *Transactor) SetPendingTracker(tracker *PendingTxTracker) {
|
|
|
|
t.pendingTracker = tracker
|
|
|
|
}
|
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
// SetNetworkID selects a correct network.
|
|
|
|
func (t *Transactor) SetNetworkID(networkID uint64) {
|
|
|
|
t.networkID = networkID
|
|
|
|
}
|
|
|
|
|
2023-06-21 14:09:55 +00:00
|
|
|
func (t *Transactor) NetworkID() uint64 {
|
|
|
|
return t.networkID
|
|
|
|
}
|
|
|
|
|
2018-04-10 10:02:54 +00:00
|
|
|
// SetRPC sets RPC params, a client and a timeout
|
|
|
|
func (t *Transactor) SetRPC(rpcClient *rpc.Client, timeout time.Duration) {
|
2022-06-09 13:09:56 +00:00
|
|
|
t.rpcWrapper = newRPCWrapper(rpcClient, rpcClient.UpstreamChainID)
|
2018-04-10 10:02:54 +00:00
|
|
|
t.rpcCallTimeout = timeout
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
|
2024-06-27 21:27:09 +00:00
|
|
|
func (t *Transactor) NextNonce(rpcClient rpc.ClientInterface, chainID uint64, from types.Address) (uint64, error) {
|
2022-12-19 12:37:37 +00:00
|
|
|
wrapper := newRPCWrapper(rpcClient, chainID)
|
2023-12-19 13:38:01 +00:00
|
|
|
ctx := context.Background()
|
2024-03-12 09:15:30 +00:00
|
|
|
nonce, err := wrapper.PendingNonceAt(ctx, common.Address(from))
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// We need to take into consideration all pending transactions in case of Optimism, cause the network returns always
|
|
|
|
// the nonce of last executed tx + 1 for the next nonce value.
|
|
|
|
if chainID == wallet_common.OptimismMainnet ||
|
2024-10-15 07:29:21 +00:00
|
|
|
chainID == wallet_common.OptimismSepolia {
|
2024-03-12 09:15:30 +00:00
|
|
|
if t.pendingTracker != nil {
|
2024-03-22 12:32:19 +00:00
|
|
|
countOfPendingTXs, err := t.pendingTracker.CountPendingTxsFromNonce(wallet_common.ChainID(chainID), common.Address(from), nonce)
|
2024-03-12 09:15:30 +00:00
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
return nonce + countOfPendingTXs, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nonce, err
|
2022-12-19 12:37:37 +00:00
|
|
|
}
|
2023-11-06 09:26:02 +00:00
|
|
|
|
2023-11-02 11:35:28 +00:00
|
|
|
func (t *Transactor) EstimateGas(network *params.Network, from common.Address, to common.Address, value *big.Int, input []byte) (uint64, error) {
|
|
|
|
rpcWrapper := newRPCWrapper(t.rpcWrapper.RPCClient, network.ChainID)
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
msg := ethereum.CallMsg{
|
|
|
|
From: from,
|
|
|
|
To: &to,
|
|
|
|
Value: value,
|
|
|
|
Data: input,
|
|
|
|
}
|
|
|
|
|
|
|
|
return rpcWrapper.EstimateGas(ctx, msg)
|
|
|
|
}
|
2022-12-19 12:37:37 +00:00
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
// SendTransaction is an implementation of eth_sendTransaction. It queues the tx to the sign queue.
|
2024-08-12 12:07:32 +00:00
|
|
|
func (t *Transactor) SendTransaction(sendArgs SendTxArgs, verifiedAccount *account.SelectedExtKey, lastUsedNonce int64) (hash types.Hash, nonce uint64, err error) {
|
|
|
|
hash, nonce, err = t.validateAndPropagate(t.rpcWrapper, verifiedAccount, sendArgs, lastUsedNonce)
|
2022-06-09 13:09:56 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-08-12 12:07:32 +00:00
|
|
|
func (t *Transactor) SendTransactionWithChainID(chainID uint64, sendArgs SendTxArgs, lastUsedNonce int64, verifiedAccount *account.SelectedExtKey) (hash types.Hash, nonce uint64, err error) {
|
2022-06-09 13:09:56 +00:00
|
|
|
wrapper := newRPCWrapper(t.rpcWrapper.RPCClient, chainID)
|
2024-08-12 12:07:32 +00:00
|
|
|
hash, nonce, err = t.validateAndPropagate(wrapper, verifiedAccount, sendArgs, lastUsedNonce)
|
2018-08-16 11:37:53 +00:00
|
|
|
return
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
|
2024-08-12 12:07:32 +00:00
|
|
|
func (t *Transactor) ValidateAndBuildTransaction(chainID uint64, sendArgs SendTxArgs, lastUsedNonce int64) (tx *gethtypes.Transaction, nonce uint64, err error) {
|
2023-09-29 17:56:27 +00:00
|
|
|
wrapper := newRPCWrapper(t.rpcWrapper.RPCClient, chainID)
|
2024-08-12 12:07:32 +00:00
|
|
|
tx, err = t.validateAndBuildTransaction(wrapper, sendArgs, lastUsedNonce)
|
2024-09-17 14:03:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, 0, err
|
|
|
|
}
|
|
|
|
|
2024-08-12 12:07:32 +00:00
|
|
|
return tx, tx.Nonce(), err
|
2023-09-29 17:56:27 +00:00
|
|
|
}
|
|
|
|
|
2023-11-24 15:39:36 +00:00
|
|
|
func (t *Transactor) AddSignatureToTransaction(chainID uint64, tx *gethtypes.Transaction, sig []byte) (*gethtypes.Transaction, error) {
|
2023-09-29 17:56:27 +00:00
|
|
|
if len(sig) != ValidSignatureSize {
|
2023-11-24 15:39:36 +00:00
|
|
|
return nil, ErrInvalidSignatureSize
|
2023-09-29 17:56:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rpcWrapper := newRPCWrapper(t.rpcWrapper.RPCClient, chainID)
|
|
|
|
chID := big.NewInt(int64(rpcWrapper.chainID))
|
|
|
|
|
|
|
|
signer := gethtypes.NewLondonSigner(chID)
|
2023-11-24 15:39:36 +00:00
|
|
|
txWithSignature, err := tx.WithSignature(signer, sig)
|
2023-09-29 17:56:27 +00:00
|
|
|
if err != nil {
|
2023-11-24 15:39:36 +00:00
|
|
|
return nil, err
|
2023-09-29 17:56:27 +00:00
|
|
|
}
|
|
|
|
|
2023-11-24 15:39:36 +00:00
|
|
|
return txWithSignature, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Transactor) SendRawTransaction(chainID uint64, rawTx string) error {
|
|
|
|
rpcWrapper := newRPCWrapper(t.rpcWrapper.RPCClient, chainID)
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
return rpcWrapper.SendRawTransaction(ctx, rawTx)
|
|
|
|
}
|
|
|
|
|
2024-03-22 12:32:19 +00:00
|
|
|
func createPendingTransaction(from common.Address, symbol string, chainID uint64, multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) (pTx *PendingTransaction) {
|
2024-03-12 09:15:30 +00:00
|
|
|
|
|
|
|
pTx = &PendingTransaction{
|
|
|
|
Hash: tx.Hash(),
|
|
|
|
Timestamp: uint64(time.Now().Unix()),
|
|
|
|
Value: bigint.BigInt{Int: tx.Value()},
|
|
|
|
From: from,
|
|
|
|
To: *tx.To(),
|
|
|
|
Nonce: tx.Nonce(),
|
|
|
|
Data: string(tx.Data()),
|
|
|
|
Type: WalletTransfer,
|
|
|
|
ChainID: wallet_common.ChainID(chainID),
|
|
|
|
MultiTransactionID: multiTransactionID,
|
|
|
|
Symbol: symbol,
|
|
|
|
AutoDelete: new(bool),
|
|
|
|
}
|
|
|
|
// Transaction downloader will delete pending transaction as soon as it is confirmed
|
|
|
|
*pTx.AutoDelete = false
|
|
|
|
return
|
|
|
|
}
|
2023-11-24 15:39:36 +00:00
|
|
|
|
2024-07-08 09:02:06 +00:00
|
|
|
func (t *Transactor) StoreAndTrackPendingTx(from common.Address, symbol string, chainID uint64, multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) error {
|
|
|
|
if t.pendingTracker == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
pTx := createPendingTransaction(from, symbol, chainID, multiTransactionID, tx)
|
|
|
|
return t.pendingTracker.StoreAndTrackPendingTx(pTx)
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:15:30 +00:00
|
|
|
func (t *Transactor) sendTransaction(rpcWrapper *rpcWrapper, from common.Address, symbol string,
|
|
|
|
multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) (hash types.Hash, err error) {
|
2023-09-29 17:56:27 +00:00
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
|
|
|
|
2023-11-24 15:39:36 +00:00
|
|
|
if err := rpcWrapper.SendTransaction(ctx, tx); err != nil {
|
2023-09-29 17:56:27 +00:00
|
|
|
return hash, err
|
|
|
|
}
|
2024-03-12 09:15:30 +00:00
|
|
|
|
2024-07-08 09:02:06 +00:00
|
|
|
err = t.StoreAndTrackPendingTx(from, symbol, rpcWrapper.chainID, multiTransactionID, tx)
|
|
|
|
if err != nil {
|
|
|
|
return hash, err
|
2024-03-12 09:15:30 +00:00
|
|
|
}
|
|
|
|
|
2023-11-24 15:39:36 +00:00
|
|
|
return types.Hash(tx.Hash()), nil
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:15:30 +00:00
|
|
|
func (t *Transactor) SendTransactionWithSignature(from common.Address, symbol string,
|
|
|
|
multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) (hash types.Hash, err error) {
|
|
|
|
rpcWrapper := newRPCWrapper(t.rpcWrapper.RPCClient, tx.ChainId().Uint64())
|
|
|
|
|
|
|
|
return t.sendTransaction(rpcWrapper, from, symbol, multiTransactionID, tx)
|
|
|
|
}
|
|
|
|
|
2024-05-26 08:31:13 +00:00
|
|
|
// BuildTransactionAndSendWithSignature receive a transaction and a signature, serialize them together
|
2019-02-15 11:31:20 +00:00
|
|
|
// It's different from eth_sendRawTransaction because it receives a signature and not a serialized transaction with signature.
|
|
|
|
// Since the transactions is already signed, we assume it was validated and used the right nonce.
|
2023-12-19 13:38:01 +00:00
|
|
|
func (t *Transactor) BuildTransactionWithSignature(chainID uint64, args SendTxArgs, sig []byte) (*gethtypes.Transaction, error) {
|
2019-02-15 11:31:20 +00:00
|
|
|
if !args.Valid() {
|
2023-12-19 13:38:01 +00:00
|
|
|
return nil, ErrInvalidSendTxArgs
|
2019-02-15 11:31:20 +00:00
|
|
|
}
|
|
|
|
|
2023-09-29 17:56:27 +00:00
|
|
|
if len(sig) != ValidSignatureSize {
|
2023-12-19 13:38:01 +00:00
|
|
|
return nil, ErrInvalidSignatureSize
|
2019-03-01 13:49:30 +00:00
|
|
|
}
|
|
|
|
|
2019-02-21 09:53:39 +00:00
|
|
|
tx := t.buildTransaction(args)
|
2023-12-19 13:38:01 +00:00
|
|
|
expectedNonce, err := t.NextNonce(t.rpcWrapper.RPCClient, chainID, args.From)
|
2019-02-15 11:31:20 +00:00
|
|
|
if err != nil {
|
2023-12-19 13:38:01 +00:00
|
|
|
return nil, err
|
2023-11-17 11:38:12 +00:00
|
|
|
}
|
2019-02-15 11:31:20 +00:00
|
|
|
|
2019-02-21 09:53:39 +00:00
|
|
|
if tx.Nonce() != expectedNonce {
|
2023-12-19 13:38:01 +00:00
|
|
|
return nil, &ErrBadNonce{tx.Nonce(), expectedNonce}
|
2019-02-15 11:31:20 +00:00
|
|
|
}
|
|
|
|
|
2023-12-01 16:42:08 +00:00
|
|
|
txWithSignature, err := t.AddSignatureToTransaction(chainID, tx, sig)
|
|
|
|
if err != nil {
|
2023-12-19 13:38:01 +00:00
|
|
|
return nil, err
|
2023-12-01 16:42:08 +00:00
|
|
|
}
|
|
|
|
|
2023-12-19 13:38:01 +00:00
|
|
|
return txWithSignature, nil
|
2019-02-15 11:31:20 +00:00
|
|
|
}
|
|
|
|
|
2019-11-23 17:57:05 +00:00
|
|
|
func (t *Transactor) HashTransaction(args SendTxArgs) (validatedArgs SendTxArgs, hash types.Hash, err error) {
|
2019-02-21 09:53:39 +00:00
|
|
|
if !args.Valid() {
|
|
|
|
return validatedArgs, hash, ErrInvalidSendTxArgs
|
|
|
|
}
|
|
|
|
|
|
|
|
validatedArgs = args
|
|
|
|
|
2023-12-19 13:38:01 +00:00
|
|
|
nonce, err := t.NextNonce(t.rpcWrapper.RPCClient, t.rpcWrapper.chainID, args.From)
|
2019-02-21 09:53:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return validatedArgs, hash, err
|
|
|
|
}
|
|
|
|
|
|
|
|
gasPrice := (*big.Int)(args.GasPrice)
|
2021-08-10 08:48:11 +00:00
|
|
|
gasFeeCap := (*big.Int)(args.MaxFeePerGas)
|
|
|
|
gasTipCap := (*big.Int)(args.MaxPriorityFeePerGas)
|
2024-07-17 08:11:34 +00:00
|
|
|
if args.GasPrice == nil && !args.IsDynamicFeeTx() {
|
2019-02-21 09:53:39 +00:00
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
2022-06-09 13:09:56 +00:00
|
|
|
gasPrice, err = t.rpcWrapper.SuggestGasPrice(ctx)
|
2019-02-21 09:53:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return validatedArgs, hash, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
chainID := big.NewInt(int64(t.networkID))
|
|
|
|
value := (*big.Int)(args.Value)
|
|
|
|
|
|
|
|
var gas uint64
|
|
|
|
if args.Gas == nil {
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
2019-12-19 18:27:27 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
gethTo common.Address
|
|
|
|
gethToPtr *common.Address
|
|
|
|
)
|
|
|
|
if args.To != nil {
|
|
|
|
gethTo = common.Address(*args.To)
|
|
|
|
gethToPtr = &gethTo
|
|
|
|
}
|
2024-07-17 08:11:34 +00:00
|
|
|
if args.IsDynamicFeeTx() {
|
2022-06-09 13:09:56 +00:00
|
|
|
gas, err = t.rpcWrapper.EstimateGas(ctx, ethereum.CallMsg{
|
2021-08-10 08:48:11 +00:00
|
|
|
From: common.Address(args.From),
|
|
|
|
To: gethToPtr,
|
|
|
|
GasFeeCap: gasFeeCap,
|
|
|
|
GasTipCap: gasTipCap,
|
|
|
|
Value: value,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
})
|
|
|
|
} else {
|
2022-06-09 13:09:56 +00:00
|
|
|
gas, err = t.rpcWrapper.EstimateGas(ctx, ethereum.CallMsg{
|
2021-08-10 08:48:11 +00:00
|
|
|
From: common.Address(args.From),
|
|
|
|
To: gethToPtr,
|
|
|
|
GasPrice: gasPrice,
|
|
|
|
Value: value,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
})
|
|
|
|
}
|
2019-02-21 09:53:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return validatedArgs, hash, err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
gas = uint64(*args.Gas)
|
|
|
|
}
|
|
|
|
|
|
|
|
newNonce := hexutil.Uint64(nonce)
|
|
|
|
newGas := hexutil.Uint64(gas)
|
|
|
|
validatedArgs.Nonce = &newNonce
|
2024-07-17 08:11:34 +00:00
|
|
|
if !args.IsDynamicFeeTx() {
|
2021-08-10 08:48:11 +00:00
|
|
|
validatedArgs.GasPrice = (*hexutil.Big)(gasPrice)
|
|
|
|
} else {
|
|
|
|
validatedArgs.MaxPriorityFeePerGas = (*hexutil.Big)(gasTipCap)
|
|
|
|
validatedArgs.MaxPriorityFeePerGas = (*hexutil.Big)(gasFeeCap)
|
|
|
|
}
|
2019-02-21 09:53:39 +00:00
|
|
|
validatedArgs.Gas = &newGas
|
|
|
|
|
|
|
|
tx := t.buildTransaction(validatedArgs)
|
2021-07-07 06:11:09 +00:00
|
|
|
hash = types.Hash(gethtypes.NewLondonSigner(chainID).Hash(tx))
|
2019-02-21 09:53:39 +00:00
|
|
|
|
|
|
|
return validatedArgs, hash, nil
|
|
|
|
}
|
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
// make sure that only account which created the tx can complete it
|
|
|
|
func (t *Transactor) validateAccount(args SendTxArgs, selectedAccount *account.SelectedExtKey) error {
|
|
|
|
if selectedAccount == nil {
|
|
|
|
return account.ErrNoAccountSelected
|
|
|
|
}
|
|
|
|
|
2018-08-16 11:37:53 +00:00
|
|
|
if !bytes.Equal(args.From.Bytes(), selectedAccount.Address.Bytes()) {
|
|
|
|
return ErrInvalidTxSender
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-08-12 12:07:32 +00:00
|
|
|
func (t *Transactor) validateAndBuildTransaction(rpcWrapper *rpcWrapper, args SendTxArgs, lastUsedNonce int64) (tx *gethtypes.Transaction, err error) {
|
2018-04-09 08:18:22 +00:00
|
|
|
if !args.Valid() {
|
2023-12-19 13:38:01 +00:00
|
|
|
return tx, ErrInvalidSendTxArgs
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
2022-12-19 12:37:37 +00:00
|
|
|
|
2023-11-17 11:38:12 +00:00
|
|
|
var nonce uint64
|
2022-12-19 12:37:37 +00:00
|
|
|
if args.Nonce != nil {
|
|
|
|
nonce = uint64(*args.Nonce)
|
2023-11-17 11:38:12 +00:00
|
|
|
} else {
|
2024-08-12 12:07:32 +00:00
|
|
|
// some chains, like arbitrum doesn't count pending txs in the nonce, so we need to calculate it manually
|
|
|
|
if lastUsedNonce < 0 {
|
|
|
|
nonce, err = t.NextNonce(rpcWrapper.RPCClient, rpcWrapper.chainID, args.From)
|
|
|
|
if err != nil {
|
|
|
|
return tx, err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nonce = uint64(lastUsedNonce) + 1
|
2023-11-17 11:38:12 +00:00
|
|
|
}
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
2023-11-17 11:38:12 +00:00
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
2020-11-20 08:57:22 +00:00
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
gasPrice := (*big.Int)(args.GasPrice)
|
2024-07-17 08:11:34 +00:00
|
|
|
// GasPrice should be estimated only for LegacyTx
|
2021-07-14 07:48:01 +00:00
|
|
|
if !args.IsDynamicFeeTx() && args.GasPrice == nil {
|
2022-06-09 13:09:56 +00:00
|
|
|
gasPrice, err = rpcWrapper.SuggestGasPrice(ctx)
|
2018-04-09 08:18:22 +00:00
|
|
|
if err != nil {
|
2023-12-19 13:38:01 +00:00
|
|
|
return tx, err
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-29 17:56:27 +00:00
|
|
|
|
2018-04-09 08:18:22 +00:00
|
|
|
value := (*big.Int)(args.Value)
|
|
|
|
var gas uint64
|
2021-07-14 07:48:01 +00:00
|
|
|
if args.Gas != nil {
|
|
|
|
gas = uint64(*args.Gas)
|
2024-07-17 08:11:34 +00:00
|
|
|
} else {
|
2018-04-09 08:18:22 +00:00
|
|
|
ctx, cancel = context.WithTimeout(context.Background(), t.rpcCallTimeout)
|
|
|
|
defer cancel()
|
2019-12-19 18:27:27 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
gethTo common.Address
|
|
|
|
gethToPtr *common.Address
|
|
|
|
)
|
|
|
|
if args.To != nil {
|
|
|
|
gethTo = common.Address(*args.To)
|
|
|
|
gethToPtr = &gethTo
|
|
|
|
}
|
2024-07-17 08:11:34 +00:00
|
|
|
if args.IsDynamicFeeTx() {
|
|
|
|
gasFeeCap := (*big.Int)(args.MaxFeePerGas)
|
|
|
|
gasTipCap := (*big.Int)(args.MaxPriorityFeePerGas)
|
2024-09-17 14:03:49 +00:00
|
|
|
gas, err = rpcWrapper.EstimateGas(ctx, ethereum.CallMsg{
|
2024-07-17 08:11:34 +00:00
|
|
|
From: common.Address(args.From),
|
|
|
|
To: gethToPtr,
|
|
|
|
GasFeeCap: gasFeeCap,
|
|
|
|
GasTipCap: gasTipCap,
|
|
|
|
Value: value,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
})
|
|
|
|
} else {
|
2024-09-17 14:03:49 +00:00
|
|
|
gas, err = rpcWrapper.EstimateGas(ctx, ethereum.CallMsg{
|
2024-07-17 08:11:34 +00:00
|
|
|
From: common.Address(args.From),
|
|
|
|
To: gethToPtr,
|
|
|
|
GasPrice: gasPrice,
|
|
|
|
Value: value,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
})
|
|
|
|
}
|
2018-04-09 08:18:22 +00:00
|
|
|
if err != nil {
|
2023-12-19 13:38:01 +00:00
|
|
|
return tx, err
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
|
|
|
}
|
2023-12-19 13:38:01 +00:00
|
|
|
|
2023-09-29 17:56:27 +00:00
|
|
|
tx = t.buildTransactionWithOverrides(nonce, value, gas, gasPrice, args)
|
2023-12-19 13:38:01 +00:00
|
|
|
return tx, nil
|
2023-09-29 17:56:27 +00:00
|
|
|
}
|
|
|
|
|
2024-08-12 12:07:32 +00:00
|
|
|
func (t *Transactor) validateAndPropagate(rpcWrapper *rpcWrapper, selectedAccount *account.SelectedExtKey, args SendTxArgs, lastUsedNonce int64) (hash types.Hash, nonce uint64, err error) {
|
2024-09-23 07:19:00 +00:00
|
|
|
symbol := args.Symbol
|
|
|
|
if args.Version == SendTxArgsVersion1 {
|
|
|
|
symbol = args.FromTokenID
|
|
|
|
}
|
|
|
|
|
2023-09-29 17:56:27 +00:00
|
|
|
if err = t.validateAccount(args, selectedAccount); err != nil {
|
2024-08-12 12:07:32 +00:00
|
|
|
return hash, nonce, err
|
2023-09-29 17:56:27 +00:00
|
|
|
}
|
|
|
|
|
2024-08-12 12:07:32 +00:00
|
|
|
tx, err := t.validateAndBuildTransaction(rpcWrapper, args, lastUsedNonce)
|
2023-09-29 17:56:27 +00:00
|
|
|
if err != nil {
|
2024-08-12 12:07:32 +00:00
|
|
|
return hash, nonce, err
|
2023-09-29 17:56:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chainID := big.NewInt(int64(rpcWrapper.chainID))
|
2021-07-07 06:11:09 +00:00
|
|
|
signedTx, err := gethtypes.SignTx(tx, gethtypes.NewLondonSigner(chainID), selectedAccount.AccountKey.PrivateKey)
|
2018-04-09 08:18:22 +00:00
|
|
|
if err != nil {
|
2024-08-12 12:07:32 +00:00
|
|
|
return hash, nonce, err
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
2018-06-06 07:35:32 +00:00
|
|
|
|
2024-09-23 07:19:00 +00:00
|
|
|
hash, err = t.sendTransaction(rpcWrapper, common.Address(args.From), symbol, args.MultiTransactionID, signedTx)
|
2024-08-12 12:07:32 +00:00
|
|
|
return hash, tx.Nonce(), err
|
2018-04-09 08:18:22 +00:00
|
|
|
}
|
2019-02-21 09:53:39 +00:00
|
|
|
|
2019-11-23 17:57:05 +00:00
|
|
|
func (t *Transactor) buildTransaction(args SendTxArgs) *gethtypes.Transaction {
|
2023-11-28 17:59:23 +00:00
|
|
|
var (
|
|
|
|
nonce uint64
|
|
|
|
value *big.Int
|
|
|
|
gas uint64
|
|
|
|
gasPrice *big.Int
|
|
|
|
)
|
|
|
|
if args.Nonce != nil {
|
|
|
|
nonce = uint64(*args.Nonce)
|
|
|
|
}
|
|
|
|
if args.Value != nil {
|
|
|
|
value = (*big.Int)(args.Value)
|
|
|
|
}
|
|
|
|
if args.Gas != nil {
|
|
|
|
gas = uint64(*args.Gas)
|
|
|
|
}
|
|
|
|
if args.GasPrice != nil {
|
|
|
|
gasPrice = (*big.Int)(args.GasPrice)
|
|
|
|
}
|
2019-02-21 09:53:39 +00:00
|
|
|
|
2019-12-19 18:27:27 +00:00
|
|
|
return t.buildTransactionWithOverrides(nonce, value, gas, gasPrice, args)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Transactor) buildTransactionWithOverrides(nonce uint64, value *big.Int, gas uint64, gasPrice *big.Int, args SendTxArgs) *gethtypes.Transaction {
|
2019-11-23 17:57:05 +00:00
|
|
|
var tx *gethtypes.Transaction
|
2019-02-21 09:53:39 +00:00
|
|
|
|
|
|
|
if args.To != nil {
|
2021-07-14 07:48:01 +00:00
|
|
|
to := common.Address(*args.To)
|
|
|
|
var txData gethtypes.TxData
|
|
|
|
|
|
|
|
if args.IsDynamicFeeTx() {
|
|
|
|
gasTipCap := (*big.Int)(args.MaxPriorityFeePerGas)
|
|
|
|
gasFeeCap := (*big.Int)(args.MaxFeePerGas)
|
|
|
|
|
|
|
|
txData = &gethtypes.DynamicFeeTx{
|
|
|
|
Nonce: nonce,
|
|
|
|
Gas: gas,
|
|
|
|
GasTipCap: gasTipCap,
|
|
|
|
GasFeeCap: gasFeeCap,
|
|
|
|
To: &to,
|
|
|
|
Value: value,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
txData = &gethtypes.LegacyTx{
|
|
|
|
Nonce: nonce,
|
|
|
|
GasPrice: gasPrice,
|
|
|
|
Gas: gas,
|
|
|
|
To: &to,
|
|
|
|
Value: value,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tx = gethtypes.NewTx(txData)
|
2019-02-21 09:53:39 +00:00
|
|
|
t.logNewTx(args, gas, gasPrice, value)
|
|
|
|
} else {
|
2021-08-19 10:28:58 +00:00
|
|
|
if args.IsDynamicFeeTx() {
|
|
|
|
gasTipCap := (*big.Int)(args.MaxPriorityFeePerGas)
|
|
|
|
gasFeeCap := (*big.Int)(args.MaxFeePerGas)
|
|
|
|
|
|
|
|
txData := &gethtypes.DynamicFeeTx{
|
|
|
|
Nonce: nonce,
|
|
|
|
Value: value,
|
|
|
|
Gas: gas,
|
|
|
|
GasTipCap: gasTipCap,
|
|
|
|
GasFeeCap: gasFeeCap,
|
|
|
|
Data: args.GetInput(),
|
|
|
|
}
|
|
|
|
tx = gethtypes.NewTx(txData)
|
|
|
|
} else {
|
|
|
|
tx = gethtypes.NewContractCreation(nonce, value, gas, gasPrice, args.GetInput())
|
|
|
|
}
|
2019-02-21 09:53:39 +00:00
|
|
|
t.logNewContract(args, gas, gasPrice, value, nonce)
|
|
|
|
}
|
|
|
|
|
|
|
|
return tx
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Transactor) logNewTx(args SendTxArgs, gas uint64, gasPrice *big.Int, value *big.Int) {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
t.logger.Info("New transaction",
|
|
|
|
zap.Stringer("From", args.From),
|
|
|
|
zap.Stringer("To", args.To),
|
|
|
|
zap.Uint64("Gas", gas),
|
|
|
|
zap.Stringer("GasPrice", gasPrice),
|
|
|
|
zap.Stringer("Value", value),
|
2019-02-21 09:53:39 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Transactor) logNewContract(args SendTxArgs, gas uint64, gasPrice *big.Int, value *big.Int, nonce uint64) {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
t.logger.Info("New contract",
|
|
|
|
zap.Stringer("From", args.From),
|
|
|
|
zap.Uint64("Gas", gas),
|
|
|
|
zap.Stringer("GasPrice", gasPrice),
|
|
|
|
zap.Stringer("Value", value),
|
|
|
|
zap.Stringer("Contract address", crypto.CreateAddress(args.From, nonce)),
|
2019-02-21 09:53:39 +00:00
|
|
|
)
|
|
|
|
}
|