Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: integrating oracle #2

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
44 changes: 39 additions & 5 deletions .artroll/config/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ query-gas-limit = "0"
pruning = "nothing"

# These are applied if and only if the pruning strategy is custom.
# pruning-keep-recent = "2"
# pruning-interval = "10"
pruning-keep-recent = "0"
pruning-interval = "0"
Comment on lines +24 to +25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove redundant pruning configuration

The pruning-keep-recent and pruning-interval settings are only applied when pruning="custom", but currently pruning="nothing" is set. These settings are redundant and should be removed or commented out.

Additionally, keeping all historical states (pruning="nothing") could lead to significant disk usage over time. Consider if this aligns with your operational requirements.

-pruning-keep-recent = "0"
-pruning-interval = "0"
+# pruning-keep-recent and pruning-interval are only used when pruning="custom"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pruning-keep-recent = "0"
pruning-interval = "0"
# pruning-keep-recent and pruning-interval are only used when pruning="custom"


# HaltHeight contains a non-zero block height at which a node will gracefully
# halt and shutdown that can be used to assist upgrades and testing.
Expand Down Expand Up @@ -133,7 +133,7 @@ enable = true
swagger = false

# Address defines the API server to listen on.
address = "tcp://0.0.0.0:1317"
address = "tcp://localhost:1317"

# MaxOpenConnections defines the number of maximum open connections.
max-open-connections = 1000
Expand Down Expand Up @@ -191,7 +191,7 @@ enable = true

# snapshot-interval specifies the block interval at which local state sync snapshots are
# taken (0 to disable).
snapshot-interval = 2000
snapshot-interval = 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Reconsider disabling state sync snapshots

Setting snapshot-interval = 0 disables state sync snapshots. This configuration change has the following implications:

  1. New nodes will not be able to quickly join the network using state sync.
  2. Nodes will need to sync from genesis or use alternative methods to catch up.

Consider setting a non-zero value (e.g., 1000 or 2000) to enable state sync snapshots, which can significantly reduce the time for new nodes to join the network. If disabling snapshots is intentional, please ensure this aligns with your network's operational requirements.


# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
snapshot-keep-recent = 2
Expand Down Expand Up @@ -262,7 +262,7 @@ enable = true
address = "0.0.0.0:8545"

# Address defines the EVM WebSocket server address to bind to.
ws-address = "0.0.0.0:8546"
ws-address = "127.0.0.1:8546"

# API defines a list of JSON-RPC namespaces that should be enabled
# Example: "eth,txpool,personal,net,debug,web3"
Expand Down Expand Up @@ -331,3 +331,37 @@ key-path = ""
[aspect]
apply-pool-size = 0
query-pool-size = 0


###############################################################################
### Oracle ###
###############################################################################
[oracle]
# Enabled indicates whether the oracle is enabled.
enabled = "true"

# Oracle Address is the URL of the out of process oracle sidecar. This is used to
# connect to the oracle sidecar when the application boots up. Note that the address
# can be modified at any point, but will only take effect after the application is
# restarted. This can be the address of an oracle container running on the same
# machine or a remote machine.
oracle_address = "localhost:8080"

# Client Timeout is the time that the client is willing to wait for responses from
# the oracle before timing out. The recommended timeout is 3 seconds (3000ms).
client_timeout = "2s"

# MetricsEnabled determines whether oracle metrics are enabled. Specifically
# this enables instrumentation of the oracle client and the interaction between
# the oracle and the app.
metrics_enabled = "true"

# PriceTTL is the maximum age of the latest price response before it is considered stale.
# The recommended max age is 10 seconds (10s). If this is greater than 1 minute (1m), the app
# will not start.
price_ttl = "0s"

# Interval is the time between each price update request. The recommended interval
# is the block time of the chain. Otherwise, 1.5 seconds (1500ms) is a good default. If this
# is greater than 1 minute (1m), the app will not start.
interval = "0s"
20 changes: 18 additions & 2 deletions .artroll/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# The version of the CometBFT binary that created or
# last modified the config file. Do not modify this.
version = "0.38.7"
version = "0.38.12"

#######################################################################
### Main Base Config Options ###
Expand Down Expand Up @@ -87,7 +87,7 @@ filter_peers = false
[rpc]

# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://0.0.0.0:26657"
laddr = "tcp://127.0.0.1:26657"

# A list of origins a cross-domain request can be executed from
# Default value '[]' disables cors support
Expand Down Expand Up @@ -168,6 +168,11 @@ experimental_close_on_slow_client = false
# See https://github.com/tendermint/tendermint/issues/3435
timeout_broadcast_tx_commit = "10s"

# Maximum number of requests that can be sent in a batch
# If the value is set to '0' (zero-value), then no maximum batch size will be
# enforced for a JSON-RPC batch request.
max_request_batch_size = 10

# Maximum size of request body, in bytes
max_body_bytes = 1000000

Expand Down Expand Up @@ -283,6 +288,17 @@ type = "flood"
# you can disable rechecking.
recheck = true

# recheck_timeout is the time the application has during the rechecking process
# to return CheckTx responses, once all requests have been sent. Responses that
# arrive after the timeout expires are discarded. It only applies to
# non-local ABCI clients and when recheck is enabled.
#
# The ideal value will strongly depend on the application. It could roughly be estimated as the
# average size of the mempool multiplied by the average time it takes the application to validate one
# transaction. We consider that the ABCI application runs in the same location as the CometBFT binary
# so that the recheck duration is not affected by network delays when making requests and receiving responses.
recheck_timeout = "1s"

# Broadcast (default: true) defines whether the mempool should relay
# transactions to other peers. Setting this to false will stop the mempool
# from relaying transactions to other peers until they are included in a
Expand Down
92 changes: 32 additions & 60 deletions .artroll/config/genesis.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"app_name": "artela-rollkitd",
"app_version": "",
"genesis_time": "2024-08-19T02:50:07.087678Z",
"genesis_time": "2024-10-31T09:32:52.04732Z",
"chain_id": "artroll_11820-1",
"initial_height": 1,
"app_hash": null,
"app_state": {
"contract_config": {
"deployer_private_key": "0xe7214230c789c557cdd730d210a5ab0c05ee77e1990262caf9be8f6b2918bb9c",
"oracle_address": "0xd9688b956ca93049a5686f6f88ab7dc910fab635"
},
Comment on lines +9 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security Risk: Private key exposed in genesis configuration

The deployer_private_key is hardcoded in the genesis configuration. This is a critical security risk as private keys should never be stored in configuration files, especially if they will be committed to version control.

Consider:

  1. Using environment variables or secure key management solutions
  2. Implementing a secure key deployment process
  3. Rotating the exposed private key immediately
🧰 Tools
🪛 Gitleaks

10-10: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

"06-solomachine": null,
"07-tendermint": null,
"auth": {
Expand All @@ -29,31 +33,10 @@
},
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "art1dq4gtx924wn6k034qfxel0klacty2gd7cktd2j",
"address": "art1m95gh9tv4ycynftgdahc32maeyg04d34wteys4",
"pub_key": null,
"account_number": "1",
"sequence": "0"
},
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "art1a2flg0np0fcrjuygyzgzuf6xc3mxct8d9rukzd",
"pub_key": null,
"account_number": "2",
"sequence": "0"
},
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "art1z5jgh3an6hrl7ghdcdftpdztksjxl0gpjsg03v",
"pub_key": null,
"account_number": "3",
"sequence": "0"
},
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "art12uhkvq0axk452ctlvn0q55zgnymq6clml5064g",
"pub_key": null,
"account_number": "4",
"sequence": "0"
}
]
},
Expand All @@ -71,34 +54,7 @@
"coins": []
},
{
"address": "art1z5jgh3an6hrl7ghdcdftpdztksjxl0gpjsg03v",
"coins": [
{
"denom": "aart",
"amount": "100000000000000000000000000"
}
]
},
{
"address": "art12uhkvq0axk452ctlvn0q55zgnymq6clml5064g",
"coins": [
{
"denom": "aart",
"amount": "100000000000000000000000000"
}
]
},
{
"address": "art1dq4gtx924wn6k034qfxel0klacty2gd7cktd2j",
"coins": [
{
"denom": "aart",
"amount": "100000000000000000000000000"
}
]
},
{
"address": "art1a2flg0np0fcrjuygyzgzuf6xc3mxct8d9rukzd",
"address": "art1m95gh9tv4ycynftgdahc32maeyg04d34wteys4",
"coins": [
{
"denom": "aart",
Expand Down Expand Up @@ -177,7 +133,7 @@
"shanghai_block": "0",
"cancun_block": "0"
},
"allow_unprotected_txs": true
"allow_unprotected_txs": false
},
"accounts": [
{
Expand Down Expand Up @@ -230,18 +186,18 @@
},
"min_self_delegation": "1",
"delegator_address": "",
"validator_address": "artvaloper1dq4gtx924wn6k034qfxel0klacty2gd7k6rtfd",
"validator_address": "artvaloper1m95gh9tv4ycynftgdahc32maeyg04d34q83zn2",
"pubkey": {
"@type": "/cosmos.crypto.ed25519.PubKey",
"key": "+SrfTnc7KUBAvp1s2LdutuDBc6kr6+nBCXtzPG7t4VM="
"key": "14petMmAddY+HnS8hpa3UOJMDYHO7TC1ulmzX0zmyM0="
},
"value": {
"denom": "aart",
"amount": "1000000000000000000000"
}
}
],
"memo": "[email protected]:26656",
"memo": "[email protected]:26656",
"timeout_height": "0",
"extension_options": [],
"non_critical_extension_options": []
Expand All @@ -251,7 +207,7 @@
{
"public_key": {
"@type": "/artela.crypto.ethsecp256k1.PubKey",
"key": "Awf7YAGa6sZwRCo/iEUoCubZd1dPVYgf5VPGDmjPmNzk"
"key": "AgTodyD8tzCtnJzTAYSmXgve2r74/JUJ57L/Ua0Gh+JK"
},
"mode_info": {
"single": {
Expand All @@ -275,7 +231,7 @@
"tip": null
},
"signatures": [
"SjrsqJaKSLJj/Q6zaV4E5h86YYtfkLpb+fCmCfxyz6hgGKRJ7guAC4fBTi0YrbU+wJJZeNZF3akMP+I7k/Pp8AE="
"mzSE1bxWoL0QUzwnd3diKzRDc0nlL6ztm479bLf5Ho8PIH4OjNNg4tHyFqSOrqKMFyI2zAq7AtZ+dtPCY86WRAA="
]
}
]
Expand Down Expand Up @@ -396,6 +352,18 @@
}
}
},
"marketmap": {
"market_map": {
"markets": {}
},
"last_updated": "0",
"params": {
"market_authorities": [
"art10d07y265gmmuvt4z0w9aw880jnsr700jv60jp4"
],
"admin": "art10d07y265gmmuvt4z0w9aw880jnsr700jv60jp4"
}
},
"mint": {
"minter": {
"inflation": "0.130000000000000000",
Expand All @@ -414,6 +382,10 @@
"classes": [],
"entries": []
},
"oracle": {
"currency_pair_genesis": [],
"next_id": "0"
},
"params": null,
"runtime": null,
"slashing": {
Expand Down Expand Up @@ -459,10 +431,10 @@
"consensus": {
"validators": [
{
"address": "CF9A8D94CC8941E4963EA1D441C4BD801C3ADE80",
"address": "18B914CD81014883F3DF29E36C57EEB3652BE7D3",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "+SrfTnc7KUBAvp1s2LdutuDBc6kr6+nBCXtzPG7t4VM="
"value": "14petMmAddY+HnS8hpa3UOJMDYHO7TC1ulmzX0zmyM0="
},
"power": "1000000000000000",
"name": "Rollkit Sequencer"
Expand Down Expand Up @@ -491,4 +463,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"localtestnet","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"","validator_address":"artvaloper1m95gh9tv4ycynftgdahc32maeyg04d34q83zn2","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"14petMmAddY+HnS8hpa3UOJMDYHO7TC1ulmzX0zmyM0="},"value":{"denom":"aart","amount":"1000000000000000000000"}}],"memo":"[email protected]:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/artela.crypto.ethsecp256k1.PubKey","key":"AgTodyD8tzCtnJzTAYSmXgve2r74/JUJ57L/Ua0Gh+JK"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[{"denom":"aart","amount":"4000000000000000"}],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":["mzSE1bxWoL0QUzwnd3diKzRDc0nlL6ztm479bLf5Ho8PIH4OjNNg4tHyFqSOrqKMFyI2zAq7AtZ+dtPCY86WRAA="]}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Empty delegator_address field needs to be populated.

The delegator_address field is empty in the validator creation message. This field is required and must contain a valid Artela address to specify who is delegating the initial stake to the validator.

Apply this change (replace with your actual delegator address):

-"delegator_address":"",
+"delegator_address":"artela1..."

Committable suggestion was skipped due to low confidence.

This file was deleted.

2 changes: 1 addition & 1 deletion .artroll/config/node_key.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"/TpLlf6Fl3NxKpur44PVcJvKMs8Qh3dfZaTXeMtOo8sgVj3f4bPC//uYQyqqpKlffUX3t8oDo3AMvIIjds3SdA=="}}
{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"4uUQGWGyOzgioBcmMpSVNo11Rg45f4mk28y213iIsdHA51G+kAzM9Mjs00nQJe4DwtagDcgbFwE4My2NObL8Lw=="}}
6 changes: 3 additions & 3 deletions .artroll/config/priv_validator_key.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"address": "CF9A8D94CC8941E4963EA1D441C4BD801C3ADE80",
"address": "18B914CD81014883F3DF29E36C57EEB3652BE7D3",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "+SrfTnc7KUBAvp1s2LdutuDBc6kr6+nBCXtzPG7t4VM="
"value": "14petMmAddY+HnS8hpa3UOJMDYHO7TC1ulmzX0zmyM0="
},
"priv_key": {
"type": "tendermint/PrivKeyEd25519",
"value": "yZyMb4PieN4JlHekxUcdy+UTtHMySUar40Wk+JQw9k75Kt9OdzspQEC+nWzYt2624MFzqSvr6cEJe3M8bu3hUw=="
"value": "0qBF29p7Z9W2zGPukaadCchc8V4Kprob6FcMEZaOTjrXil60yYB11j4edLyGlrdQ4kwNgc7tMLW6WbNfTObIzQ=="
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyNC0xMC0zMSAxMDozMjo1MS45OTc2MzYgKzAxMDAgQ0VUIG09KzAuMDQ2NTI5MjUxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiMzFaY3UwbGJWUEM2Zll0byJ9.5VspzZSIdQjyxhSklYgxen4X3GxTMCXYbYh-k-fsaxxKk_n1vgNvwA.DRxwSn0er3wt9Y0n.qo0A0RYIPdmYiPZhPzYVDPMN0Yvk26e9HVDzm5iSZnEYExPCiaW3FiE2oeBvIHoYResadJcKn3t3QHs8V5qoq-M9l40dRRo340Vmugsg5O9w4T1ImmCq16LKY3WbHGGwaaV3ByN1tW4ypJXCwcP3qk6U2RoTmZx-bJFlrB_2VusICIpLpfGGxIS36TgM_VeON62p8vTsZxeSCdWW7xdj3JjzQ3zDPfPVqx8gR8xuJzvsmQTtcfM.65PDrihz55cJTyf5jsBwrA

This file was deleted.

2 changes: 1 addition & 1 deletion .artroll/keyring-test/mykey.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyNC0wOC0xOSAxMDo1MDowNi44Mjg4OTQgKzA4MDAgQ1NUIG09KzAuMDUxNjMyODc2IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiaEJZVFJzRU8zQmpxdFZTbiJ9.VP0GUlPTbO5v-u8svOFT86aZHK_11kuDr9UGe9OFPCg0LKvK5WNeVA.t4nkzVN3HUxQp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7gLRPImjyhQjQ9XqXpI9E9-cRB_3cOycMCaBQ3kbPfuNS3Qp70fpzTT5M8zEExEtOWrTQ0tovLp8sbmPgwugfuXd8zL6K2IMf0uwzAhSnu6u7dZ_vRKVhhyfTkgoaIXQ.OrSO3ewroxIYyz4XT7Z4GA
1 change: 0 additions & 1 deletion .artroll/keyring-test/mykey2.info

This file was deleted.

1 change: 0 additions & 1 deletion .artroll/keyring-test/mykey3.info

This file was deleted.

Loading