-
Notifications
You must be signed in to change notification settings - Fork 48
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: ADR-004: Application links expiration time #723
Changes from 12 commits
d53e53b
01991f4
e4b68b7
5d4d03a
85bdf16
edb7793
dfe9eba
fd1a7df
1328c82
1ef5251
39449c6
054e230
450d091
7cd38b4
ece318d
f3f8ca3
60b7917
427a9f4
5c64fbf
c72eedf
7651f7e
3b0423b
95d129d
d0732e5
19913ba
677f675
4864180
ead0d98
7e00710
82fb64e
c017bf7
39a504b
9d68bce
4f2161f
356838c
bb922e5
d0d8d6e
b12d853
287f3f3
f8f4a56
011a71d
fbec69a
d3d1e9c
4a3893b
630db00
34255b6
dad645e
89949ed
ebb1059
e82bcc0
373f1aa
15862dd
13337d1
0b7a239
189adf1
8f8375b
49f030d
449e218
833415c
5f800b8
f4eef42
20fa015
beaf1dd
c5a50e7
ca7a48b
f5c76ea
9011213
8ecde9d
14a7559
a71adad
0609d8b
ae4c4a0
621434e
bf4e66b
51838d8
e401ca9
1ade38a
3191ec1
24eaccd
c4292a7
3ece866
84bc648
56859a8
a228168
efa4026
664d126
e646fd2
57154d2
13bd8e4
272c671
eaa9279
5852064
d4d3953
c17af26
d331889
d0bbd8e
e522391
f8e13ce
bb4ba3e
84bfaac
9248cb3
c63d070
4bda50c
43990e0
9f66e6b
0e1e58d
84ac02e
1aba69b
355f21d
3dccdc2
1cd567c
7e8cc9c
5048d56
189cfe1
f002354
d41df0c
95d22af
628932d
25ced70
f23948e
cd41847
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Benchmarks | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
env: | ||
GO111MODULE: "on" | ||
jobs: | ||
Benchmarks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go 🧰 | ||
uses: actions/[email protected] | ||
with: | ||
go-version: 1.15 | ||
|
||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
|
||
- name: Go cache 💾 | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg | ||
key: ${{ runner.os }}-go-pkg-${{ hashFiles('**/go.mod') }} | ||
|
||
- name: Restore benchstat 🪛 | ||
uses: actions/[email protected] | ||
with: | ||
path: ~/go/bin/benchstat | ||
key: ${{ runner.os }}-benchstat | ||
|
||
- name: Restore base benchmark result 📝 | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
bench-master.txt | ||
# Using base sha for PR or new commit hash for master/main push in benchmark result key. | ||
key: ${{ runner.os }}-bench-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} | ||
|
||
- name: Benchmark 🧮 | ||
run: REF_NAME=${GITHUB_REF##*/} make benchmark |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
syntax = "proto3"; | ||
package desmos.profiles.legacy.v200; | ||
|
||
option go_package = "github.com/desmos-labs/desmos/v2/x/profiles/legacy/v200"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why v200 but not v230? I think the legacy version should be the last version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it was since v2.0.0 that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, I thought it means the legacy There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dadamu actually also your thought makes sense. @RiccardoM How should we handle legacy code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually looking into this problem inside #730 by reviewing where different things are located for legacy stuff and updates |
||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
// ApplicationLink contains the data of a link to a centralized application | ||
message ApplicationLink { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.equal) = true; | ||
|
||
// User to which the link is associated | ||
string user = 1 [ (gogoproto.moretags) = "yaml:\"user\"" ]; | ||
|
||
// Data contains the details of this specific link | ||
Data data = 2 | ||
[ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"data\"" ]; | ||
|
||
// State of the link | ||
ApplicationLinkState state = 3 [ (gogoproto.moretags) = "yaml:\"state\"" ]; | ||
|
||
// OracleRequest represents the request that has been made to the oracle | ||
OracleRequest oracle_request = 4 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"oracle_request\"" | ||
]; | ||
|
||
// Data coming from the result of the verification. | ||
// Only available when the state is STATE_SUCCESS | ||
Result result = 5 [ (gogoproto.moretags) = "yaml:\"result\"" ]; | ||
|
||
// CreationTime represents the time in which the link was created | ||
google.protobuf.Timestamp creation_time = 6 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"creation_time\"" | ||
]; | ||
} | ||
|
||
// Data contains the data associated to a specific user of a | ||
// generic centralized application | ||
message Data { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.equal) = true; | ||
|
||
// The application name (eg. Twitter, GitHub, etc) | ||
string application = 1 [ (gogoproto.moretags) = "yaml:\"application\"" ]; | ||
// Username on the application (eg. Twitter tag, GitHub profile, etc) | ||
string username = 2 [ (gogoproto.moretags) = "yaml:\"username\"" ]; | ||
} | ||
|
||
// OracleRequest represents a generic oracle request used to | ||
// verify the ownership of a centralized application account | ||
message OracleRequest { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
option (gogoproto.equal) = true; | ||
|
||
// ID is the ID of the request | ||
uint64 id = 1 | ||
[ (gogoproto.customname) = "ID", (gogoproto.moretags) = "yaml:\"id\"" ]; | ||
|
||
// OracleScriptID is ID of an oracle script | ||
uint64 oracle_script_id = 2 [ | ||
(gogoproto.customname) = "OracleScriptID", | ||
(gogoproto.moretags) = "yaml:\"oracle_script_id\"" | ||
]; | ||
|
||
// CallData contains the data used to perform the oracle request | ||
CallData call_data = 3 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"call_data\"" | ||
]; | ||
|
||
// ClientID represents the ID of the client that has called the oracle script | ||
string client_id = 4 [ | ||
(gogoproto.customname) = "ClientID", | ||
(gogoproto.moretags) = "yaml:\"client_id\"" | ||
]; | ||
|
||
// CallData contains the data sent to a single oracle request in order to | ||
// verify the ownership of a centralized application by a Desmos profile | ||
message CallData { | ||
option (gogoproto.equal) = true; | ||
|
||
// The application for which the ownership should be verified | ||
string application = 1 [ (gogoproto.moretags) = "yaml:\"application\"" ]; | ||
|
||
// The hex encoded call data that should be used to verify the application | ||
// account ownership | ||
string call_data = 2 [ (gogoproto.moretags) = "yaml:\"call_data\"" ]; | ||
} | ||
} | ||
|
||
// ApplicationLinkState defines if an application link is in the following | ||
// states: STARTED, ERRORED, SUCCESSFUL, TIMED_OUT | ||
enum ApplicationLinkState { | ||
option (gogoproto.goproto_enum_prefix) = false; | ||
|
||
// A link has just been initialized | ||
APPLICATION_LINK_STATE_INITIALIZED_UNSPECIFIED = 0 | ||
[ (gogoproto.enumvalue_customname) = "ApplicationLinkStateInitialized" ]; | ||
// A link has just started being verified | ||
APPLICATION_LINK_STATE_VERIFICATION_STARTED = 1 | ||
[ (gogoproto.enumvalue_customname) = "AppLinkStateVerificationStarted" ]; | ||
// A link has errored during the verification process | ||
APPLICATION_LINK_STATE_VERIFICATION_ERROR = 2 | ||
[ (gogoproto.enumvalue_customname) = "AppLinkStateVerificationError" ]; | ||
// A link has being verified successfully | ||
APPLICATION_LINK_STATE_VERIFICATION_SUCCESS = 3 | ||
[ (gogoproto.enumvalue_customname) = "AppLinkStateVerificationSuccess" ]; | ||
// A link has timed out while waiting for the verification | ||
APPLICATION_LINK_STATE_TIMED_OUT = 4 | ||
[ (gogoproto.enumvalue_customname) = "AppLinkStateVerificationTimedOut" ]; | ||
} | ||
|
||
// Result represents a verification result | ||
message Result { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.equal) = true; | ||
|
||
// sum is the oneof that specifies whether this represents a success or | ||
// failure result | ||
oneof sum { | ||
// Success represents a successful verification | ||
Success success = 1; | ||
|
||
// Failed represents a failed verification | ||
Failed failed = 2; | ||
} | ||
|
||
// Success is the result of an application link that has been successfully | ||
// verified | ||
message Success { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.equal) = true; | ||
|
||
// Hex-encoded value that has be signed by the profile | ||
string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; | ||
// Hex-encoded signature that has been produced by signing the value | ||
string signature = 2 [ (gogoproto.moretags) = "yaml:\"signature\"" ]; | ||
} | ||
|
||
// Failed is the result of an application link that has not been verified | ||
// successfully | ||
message Failed { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.equal) = true; | ||
|
||
// Error that is associated with the failure | ||
string error = 1 [ (gogoproto.moretags) = "yaml:\"error\"" ]; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
syntax = "proto3"; | ||
package desmos.profiles.legacy.v200; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/desmos-labs/desmos/v2/x/profiles/legacy/v200"; | ||
|
||
// Params contains the parameters for the profiles module | ||
message Params { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
NicknameParams nickname = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"nickname\"" | ||
]; | ||
|
||
DTagParams dtag = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"dtag\"", | ||
(gogoproto.customname) = "DTag" | ||
]; | ||
|
||
BioParams bio = 3 | ||
[ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bio\"" ]; | ||
|
||
OracleParams oracle = 4 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"oracle\"" | ||
]; | ||
} | ||
|
||
// NicknameParams defines the parameters related to the profiles nicknames | ||
message NicknameParams { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
bytes min_length = 1 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"min_length\"" | ||
]; | ||
|
||
bytes max_length = 2 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"max_length\"" | ||
]; | ||
} | ||
|
||
// DTagParams defines the parameters related to profile DTags | ||
message DTagParams { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
string reg_ex = 1 [ (gogoproto.moretags) = "yaml:\"reg_ex\"" ]; | ||
|
||
bytes min_length = 2 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"min_length\"", | ||
(gogoproto.customname) = "MinLength" | ||
]; | ||
|
||
bytes max_length = 3 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"max_length\"", | ||
(gogoproto.customname) = "MaxLength" | ||
]; | ||
} | ||
|
||
// BioParams defines the parameters related to profile biography | ||
message BioParams { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
bytes max_length = 3 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"max_length\"" | ||
]; | ||
} | ||
|
||
// OracleParams defines the parameters related to the oracle | ||
// that will be used to verify the ownership of a centralized | ||
// application account by a Desmos profile | ||
message OracleParams { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
// ScriptID represents the ID of the oracle script to be called to verify the | ||
// data | ||
uint64 script_id = 1 [ | ||
(gogoproto.customname) = "ScriptID", | ||
(gogoproto.moretags) = "yaml:\"script_id\"" | ||
]; | ||
|
||
// AskCount represents the number of oracles to which ask to verify the data | ||
uint64 ask_count = 2 [ (gogoproto.moretags) = "yaml:\"ask_count\"" ]; | ||
|
||
// MinCount represents the minimum count of oracles that should complete the | ||
// verification successfully | ||
uint64 min_count = 3 [ (gogoproto.moretags) = "yaml:\"min_count\"" ]; | ||
|
||
// PrepareGas represents the amount of gas to be used during the preparation | ||
// stage of the oracle script | ||
uint64 prepare_gas = 4 [ (gogoproto.moretags) = "yaml:\"prepare_gas\"" ]; | ||
|
||
// ExecuteGas represents the amount of gas to be used during the execution of | ||
// the oracle script | ||
uint64 execute_gas = 5 [ (gogoproto.moretags) = "yaml:\"execute_gas\"" ]; | ||
|
||
// FeeAmount represents the amount of fees to be payed in order to execute the | ||
// oracle script | ||
repeated cosmos.base.v1beta1.Coin fee_amount = 6 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.moretags) = "yaml:\"fee_amount\"" | ||
]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow uses benchstat a common go tool for comparing different benchmarks results.
In our case, the workflow will compare the
master
branch benchmark's result with the ones of a new PR which is IMO very useful to let us understand if we have introduced a performance regression.In order to make this properly working, bench tests should be written when we consider it's the case.