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

feat(sequencer): integrate connect oracle and vote extension logic #1236

Merged
merged 118 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
7c39641
add slinky proto files and generated rust
noot Jul 2, 2024
a18ad26
add slinky grpc service and genesis state
noot Jul 2, 2024
b2cc653
impl most of slinky grpc methods
noot Jul 2, 2024
ff618db
add oracle option to config and connect on startup
noot Jul 2, 2024
280111d
begin vote extension handler logic
noot Jul 2, 2024
565ef67
remove unused protos
noot Jul 2, 2024
4635f40
begin oracle component
noot Jul 3, 2024
70df249
finish extend vote logic
noot Jul 3, 2024
f3045b3
finish vote extension validation in verify_vote_extension
noot Jul 3, 2024
8276363
add native types for slinky proto types
noot Jul 3, 2024
bdcd41a
merge with main, genesis updates
noot Jul 3, 2024
27267e2
update genesis example to incude market map
noot Jul 3, 2024
536fd2c
implement prepare/process proposal vote extension logic
noot Jul 3, 2024
d3ba1fa
fix sequencer block construction
noot Jul 3, 2024
8d031ca
no more unstable is_sorted
noot Jul 3, 2024
b41a719
implement finalize_block price aggregation and storing logic
noot Jul 3, 2024
f197a17
implement oracle module query service
noot Jul 4, 2024
6b84a8a
fixes based on running w sidecar, update genesis example to have oracle
noot Jul 4, 2024
25e024b
fix sequencer unit tests
noot Jul 5, 2024
bb1a975
clippy
noot Jul 5, 2024
f8dd3d6
fmt
noot Jul 5, 2024
b96ce64
remove unused protos
noot Jul 5, 2024
5f9ea4f
attempt to fix sequencer genesis in chart
noot Jul 5, 2024
078b116
lint chart
noot Jul 5, 2024
0ea34d9
maybe fix genesis in chart
noot Jul 5, 2024
63b6b2c
lint chart
noot Jul 5, 2024
72b9fc4
cleanup
noot Jul 5, 2024
5b6a99c
charts
noot Jul 5, 2024
24e916f
fmt
noot Jul 5, 2024
074e7a3
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Jul 5, 2024
0b6fd9b
add oracle config values to chart
noot Jul 6, 2024
a152b6b
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Jul 6, 2024
4192612
maybe fix chart
noot Jul 6, 2024
8877caa
merge w main
noot Jul 9, 2024
9d4f8dc
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Jul 9, 2024
936bf00
update protos
noot Jul 9, 2024
9b28345
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Jul 12, 2024
dd2b936
address comments
noot Jul 12, 2024
1fdda18
merge w main
noot Aug 19, 2024
3092971
bump chart version
noot Aug 19, 2024
573993c
merge w main
noot Aug 20, 2024
fc6d945
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Aug 20, 2024
eafff75
address comments
noot Aug 21, 2024
18af189
address comments
noot Aug 22, 2024
c87d28d
address chart comments
noot Aug 22, 2024
cd87fd4
remove clippy too many lines
noot Aug 22, 2024
08c51e4
merge w main, update genesis proto for slinky
noot Aug 22, 2024
b64fc41
update genesis to have SlinkyGenesis field
noot Aug 23, 2024
64ad809
address comments, var name cleanup
noot Aug 23, 2024
c8437f1
fix(core): restructure modules to match proto (#1405)
SuperFluffy Aug 23, 2024
71e3b78
merge w main
noot Aug 26, 2024
65fdc28
fmt protos
noot Aug 26, 2024
8c8d0eb
update buf cfg to ignore slinky lint warnings
noot Aug 26, 2024
69718e9
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Aug 29, 2024
fb1dbf7
address comments
noot Aug 29, 2024
7fd61bf
merge w main
noot Sep 3, 2024
9d71977
merge w main
noot Sep 3, 2024
ee820d9
recompile protos
noot Sep 3, 2024
c18201c
fix compiled protos
noot Sep 3, 2024
7a1838e
address comments
noot Sep 3, 2024
faa117c
use indexmap everywhere
noot Sep 3, 2024
2928513
fix chart genesis
noot Sep 4, 2024
6c8f81d
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Sep 4, 2024
6170dbb
fix merge issue
noot Sep 4, 2024
c2c7912
maybe fix chart genesis
noot Sep 4, 2024
3faeb74
maybe fix chart genesis
noot Sep 4, 2024
17e91aa
fix genesis log
noot Sep 4, 2024
3207ff9
maybe fix chart genesis
noot Sep 4, 2024
6b1f665
maybe fix charts
noot Sep 4, 2024
0db673a
maybe fix chart genesis
noot Sep 4, 2024
938df30
fix merge
noot Sep 5, 2024
f8db715
add unit test
noot Sep 5, 2024
dd817a2
merge w main
noot Sep 5, 2024
f6d43dc
cleanup
noot Sep 5, 2024
1ecfc14
cleanup
noot Sep 5, 2024
0506bba
clippy
noot Sep 5, 2024
1b8df49
refactor(sequencer): use streams for fetching slinky data from state …
SuperFluffy Sep 9, 2024
e6f34c3
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Sep 9, 2024
dca2e52
rework oracle types (#1484)
SuperFluffy Sep 19, 2024
7347bf3
merge wip
noot Sep 19, 2024
7d58ebb
fix merge
noot Sep 19, 2024
21e775a
fix tests
noot Sep 19, 2024
d0bfdf9
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Sep 24, 2024
a2c7677
bump chart
noot Sep 24, 2024
68bd014
merge w main
noot Sep 27, 2024
72f0e33
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Sep 30, 2024
6306abe
address some comments
noot Sep 30, 2024
0f1d47f
address remaining comments
noot Oct 1, 2024
42a653b
merge w main
noot Oct 1, 2024
884bfe4
merge w main
noot Oct 3, 2024
168a05a
merge w main
noot Oct 28, 2024
c877303
fix and cleanup unit tests
noot Oct 28, 2024
3edcdf0
chart and clippy
noot Oct 28, 2024
2f76b78
fix smoke tests
noot Oct 28, 2024
2bce117
fmt
noot Oct 28, 2024
bf67de6
update dev values
noot Oct 29, 2024
d2f8718
protos
noot Oct 29, 2024
477d0ec
verify vote extensions in validate_proposal
noot Oct 29, 2024
43be7e8
update verify_vote_extension to not read from state
noot Oct 29, 2024
31bf59a
merge with main
noot Oct 29, 2024
3510b0b
modify consensus_params in justfile, not genesis parser
noot Oct 29, 2024
5d99f4d
bump slinky protos to v2 and rename to connect
noot Oct 29, 2024
17cbd08
fmt proto
noot Oct 29, 2024
e2238b9
move connect protos to vendored, not astria_vendored
noot Oct 30, 2024
2e5677c
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Oct 30, 2024
33d8dd9
revert buf.lock
noot Oct 30, 2024
e5bc4ce
buf.yaml cleanup
noot Oct 30, 2024
fd69353
make connect optional in genesis
noot Oct 30, 2024
fcf8f49
handle vote_extensions_enable_height and updates to it to handle numb…
noot Nov 1, 2024
8baa0c3
clippy
noot Nov 1, 2024
fbdb015
rename ASTRIA_SEQUENCER_CONNECT_GRPC_ADDR to ASTRIA_SEQUENCER_ORACLE_…
noot Nov 4, 2024
d291a0b
only init MarketMap and Oracle components if vote extensions are enabled
noot Nov 4, 2024
9e07cb0
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Nov 4, 2024
19c81f1
update CurrencyPairId::increment
noot Nov 4, 2024
ca02d51
update charts to have configurable values and mark breaking changes
noot Nov 5, 2024
3722a2f
update vote_extensions_enable_height in chart genesis
noot Nov 5, 2024
466e458
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
noot Nov 5, 2024
cdcbaec
maybe fix genesis
noot Nov 5, 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
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion charts/sequencer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0
version: 1.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
26 changes: 25 additions & 1 deletion charts/sequencer/files/cometbft/config/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,24 @@
{{- if $index }},{{- end }}
{{ include "sequencer.address" $value }}
{{- end }}
]
],
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Should move under else statement marking genesis changes.

{{- if not .Values.global.dev }}
{{- else }}
"connect": {
"marketMap": {
"marketMap": {
"markets": {}
},
"params": {
"marketAuthorities": [],
"admin": "{{ .Values.genesis.marketAdminAddress }}"
}
},
"oracle": {
"currencyPairGenesis": [],
"nextId": "0"
}
}
{{- end}}
},
"chain_id": "{{ .Values.genesis.chainId }}",
Expand All @@ -142,7 +157,16 @@
},
"version": {
"app": "0"
},
{{- if not .Values.global.dev }}
"abci": {
"vote_extensions_enable_height": "0"
}
{{- else }}
"abci": {
"vote_extensions_enable_height": "1"
}
{{- end}}
},
"genesis_time": "{{ .Values.genesis.genesisTime }}",
"initial_height": "0",
Expand Down
3 changes: 3 additions & 0 deletions charts/sequencer/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ data:
OTEL_EXPORTER_OTLP_HEADERS: "{{ .Values.sequencer.otel.otlpHeaders }}"
OTEL_EXPORTER_OTLP_TRACE_HEADERS: "{{ .Values.sequencer.otel.traceHeaders }}"
OTEL_SERVICE_NAME: "{{ tpl .Values.sequencer.otel.serviceName . }}"
ASTRIA_SEQUENCER_ORACLE_GRPC_ADDR: "http://127.0.0.1:{{ .Values.ports.oracleGrpc }}"
ASTRIA_SEQUENCER_ORACLE_CLIENT_TIMEOUT_MILLISECONDS: "{{ .Values.sequencer.oracle.clientTimeout }}"
{{- if not .Values.global.dev }}
{{- else }}
ASTRIA_SEQUENCER_NO_ORACLE: "true"
{{- end }}
---
5 changes: 5 additions & 0 deletions charts/sequencer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ genesis:
base: "astria"
ibcCompat: "astriacompat"
authoritySudoAddress: ""
marketAdminAddress: ""
allowedFeeAssets: []
# - nria
ibc:
Expand Down Expand Up @@ -108,6 +109,8 @@ sequencer:
mempool:
parked:
maxTxCount: 200
oracle:
clientTimeout: 1000
metrics:
enabled: false
otel:
Expand Down Expand Up @@ -271,9 +274,11 @@ ports:
cometbftRpc: 26657
cometbftMetrics: 26660
sequencerABCI: 26658
# note: the oracle sidecar also uses 8080 by default but can be changed with --port
sequencerGrpc: 8080
relayerRpc: 2450
sequencerMetrics: 9000
oracleGrpc: 8081

# ServiceMonitor configuration
serviceMonitor:
Expand Down
1 change: 1 addition & 0 deletions crates/astria-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ penumbra-ibc = { workspace = true }
penumbra-proto = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
regex = { workspace = true }
serde = { workspace = true, features = ["derive"], optional = true }
sha2 = { workspace = true }
tendermint = { workspace = true }
Expand Down
74 changes: 74 additions & 0 deletions crates/astria-core/src/connect/abci.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
pub mod v2 {
use bytes::Bytes;
use indexmap::IndexMap;

use crate::{
connect::types::v2::{
CurrencyPairId,
Price,
},
generated::connect::abci::v2 as raw,
};

#[derive(Debug, thiserror::Error)]
#[error(transparent)]
pub struct OracleVoteExtensionError(#[from] OracleVoteExtensionErrorKind);

#[derive(Debug, thiserror::Error)]
#[error("failed to validate connect.abci.v2.OracleVoteExtension")]
enum OracleVoteExtensionErrorKind {
#[error("failed decoding price value in .prices field for key `{id}`")]
DecodePrice {
id: u64,
source: crate::connect::types::v2::DecodePriceError,
},
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OracleVoteExtension {
pub prices: IndexMap<CurrencyPairId, Price>,
}

impl OracleVoteExtension {
/// Converts an on-wire [`raw::OracleVoteExtension`] to a validated domain type
/// [`OracleVoteExtension`].
///
/// # Errors
/// Returns an error if a value in the `.prices` map could not be validated.
pub fn try_from_raw(
raw: raw::OracleVoteExtension,
) -> Result<Self, OracleVoteExtensionError> {
let prices = raw
.prices
.into_iter()
.map(|(id, price)| {
let price = Price::try_from(price).map_err(|source| {
OracleVoteExtensionErrorKind::DecodePrice {
id,
source,
}
})?;
Ok::<_, OracleVoteExtensionErrorKind>((CurrencyPairId::new(id), price))
})
.collect::<Result<_, _>>()?;
Ok(Self {
prices,
})
}

#[must_use]
pub fn into_raw(self) -> raw::OracleVoteExtension {
fn encode_price(input: Price) -> Bytes {
Bytes::copy_from_slice(&input.get().to_be_bytes())
}

raw::OracleVoteExtension {
prices: self
.prices
.into_iter()
.map(|(id, price)| (id.get(), encode_price(price)))
.collect(),
}
}
}
}
Loading
Loading