Skip to content

Commit

Permalink
remove over aggressive project and batch ID validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Feb 26, 2024
1 parent 33afc48 commit bff1c32
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 176 deletions.
17 changes: 0 additions & 17 deletions x/ecocredit/base/types/v1/features/msg_bridge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,6 @@ Feature: MsgBridge
When the message is validated
Then expect the error "credits[0]: batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if credits batch denom is not formatted
Given the message
"""
{
"owner": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"target": "polygon",
"recipient": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
"credits": [
{
"batch_denom": "foo"
}
]
}
"""
When the message is validated
Then expect the error "credits[0]: batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if credits amount is empty
Given the message
"""
Expand Down
11 changes: 0 additions & 11 deletions x/ecocredit/base/types/v1/features/msg_create_batch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,6 @@ Feature: MsgCreateBatch
When the message is validated
Then expect the error "project id: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if project id is not formatted
Given the message
"""
{
"issuer": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"project_id": "foo"
}
"""
When the message is validated
Then expect the error "project id: expected format <class-id>-<project-sequence>: parse error: invalid request"

Scenario: an error is returned if class id is empty
Given the message
"""
Expand Down
11 changes: 0 additions & 11 deletions x/ecocredit/base/types/v1/features/msg_mint_batch_credits.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@ Feature: MsgMintBatchCredits
When the message is validated
Then expect the error "batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if batch denom is not formatted
Given the message
"""
{
"issuer": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"batch_denom": "foo"
}
"""
When the message is validated
Then expect the error "batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if issuance is empty
Given the message
"""
Expand Down
11 changes: 0 additions & 11 deletions x/ecocredit/base/types/v1/features/msg_seal_batch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ Feature: MsgSealBatch
When the message is validated
Then expect the error "batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if batch denom is not formatted
Given the message
"""
{
"issuer": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"batch_denom": "foo"
}
"""
When the message is validated
Then expect the error "batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: a valid amino message
Given the message
"""
Expand Down
16 changes: 0 additions & 16 deletions x/ecocredit/base/types/v1/features/msg_send.feature
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,6 @@ Feature: MsgSend
When the message is validated
Then expect the error "credits[0]: batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if credits batch denom is not formatted
Given the message
"""
{
"sender": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"recipient": "regen1tnh2q55v8wyygtt9srz5safamzdengsnlm0yy4",
"credits": [
{
"batch_denom": "foo"
}
]
}
"""
When the message is validated
Then expect the error "credits[0]: batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if credits tradable amount and retired amount are empty
Given the message
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ Feature: MsgUpdateBatchMetadata
When the message is validated
Then expect the error "batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if batch denom is not formatted
Given the message
"""
{
"issuer": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"batch_denom": "foo"
}
"""
When the message is validated
Then expect the error "batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if new metadata is empty
Given the message
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ Feature: MsgUpdateProjectAdmin
When the message is validated
Then expect the error "project id: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if project id is not formatted
Given the message
"""
{
"admin": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"project_id": "foo"
}
"""
When the message is validated
Then expect the error "project id: expected format <class-id>-<project-sequence>: parse error: invalid request"

Scenario: an error is returned if new admin is empty
Given the message
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ Feature: MsgUpdateProjectMetadata
When the message is validated
Then expect the error "project id: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if project id is not formatted
Given the message
"""
{
"admin": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"project_id": "foo"
}
"""
When the message is validated
Then expect the error "project id: expected format <class-id>-<project-sequence>: parse error: invalid request"

Scenario: an error is returned if new metadata exceeds 256 characters
Given the message
"""
Expand Down
13 changes: 0 additions & 13 deletions x/ecocredit/base/types/v1/features/state_batch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,6 @@ Feature: Batch
When the batch is validated
Then expect the error "denom: empty string is not allowed: parse error"

Scenario: an error is returned if denom is not formatted
Given the batch
"""
{
"key": 1,
"issuer": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y=",
"project_key": 1,
"denom": "foo"
}
"""
When the batch is validated
Then expect the error "denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error"

Scenario: an error is returned if metadata exceeds 256 characters
Given the batch
"""
Expand Down
13 changes: 1 addition & 12 deletions x/ecocredit/base/types/v1/features/state_project.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ Feature: Project
When the project is validated
Then expect the error "project id: empty string is not allowed: parse error"

Scenario: an error is returned if id is not formatted
Given the project
"""
{
"key": 1,
"id": "foo"
}
"""
When the project is validated
Then expect the error "project id: expected format <class-id>-<project-sequence>: parse error"

Scenario: an error is returned if admin is empty
Given the project
"""
Expand All @@ -93,7 +82,7 @@ Feature: Project
}
"""
When the project is validated
Then expect the error "class key is deprecated and must be zer: parse error"
Then expect the error "class key is deprecated and must be zero: parse error"

Scenario: an error is returned if jurisdiction is empty
Given the project
Expand Down
10 changes: 0 additions & 10 deletions x/ecocredit/base/types/v1/features/types_credits.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ Feature: Credits
When the message is validated
Then expect the error "batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if batch denom is not formatted
Given the message
"""
{
"batch_denom": "foo"
}
"""
When the message is validated
Then expect the error "batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if amount is empty
Given the message
"""
Expand Down
16 changes: 0 additions & 16 deletions x/ecocredit/basket/types/v1/features/msg_put.feature
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,6 @@ Feature: MsgPut
When the message is validated
Then expect the error "credits[0]: batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if a credit batch denom is not formatted
Given the message
"""
{
"owner": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw",
"basket_denom": "eco.uC.NCT",
"credits": [
{
"batch_denom": "foo"
}
]
}
"""
When the message is validated
Then expect the error "credits[0]: batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if a credit amount is empty
Given the message
"""
Expand Down
11 changes: 0 additions & 11 deletions x/ecocredit/basket/types/v1/features/state_basket_balance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ Feature: BasketBalance
When the basket balance is validated
Then expect the error "batch denom: empty string is not allowed: parse error"

Scenario: an error is returned if batch denom is not formatted
Given the basket balance
"""
{
"basket_id": 1,
"batch_denom": "foo"
}
"""
When the basket balance is validated
Then expect the error "batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error"

Scenario: an error is returned if balance is a negative decimal
Given the basket balance
"""
Expand Down
15 changes: 0 additions & 15 deletions x/ecocredit/marketplace/types/v1/features/msg_sell.feature
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,6 @@ Feature: MsgSell
When the message is validated
Then expect the error "orders[0]: batch denom: empty string is not allowed: parse error: invalid request"

Scenario: an error is returned if order batch denom is not formatted
Given the message
"""
{
"seller": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw",
"orders": [
{
"batch_denom": "foo"
}
]
}
"""
When the message is validated
Then expect the error "orders[0]: batch denom: expected format <project-id>-<start_date>-<end_date>-<batch_sequence>: parse error: invalid request"

Scenario: an error is returned if order quantity is empty
Given the message
"""
Expand Down

0 comments on commit bff1c32

Please sign in to comment.